Saturday, July 26, 2008

Django i18n status

Here you have what, from my point of view, is the status of django i18n. Comments will be very welcome, specially from people from countries with other i18n needs than mine (based on the idea that Django i18n is perfect for people in the US, here is the troubleshooting for my country, for sure more problems exists for people in for example China).


This list is part of the analysis that I'm doing to fix all those problems. If you want to participate in making Django also "The web framework for perfectionists outside the US", please contact me.



















































Subject
Comments
Translation (static content)YesDjango has an amazing translation system, easy to use, and exceptionally automated. Also it has bidi support. Despite of this, some problems can be found when translating django or applications to other languages (masculine/femenine...).
Translation (database content)NoDjango doesn't support model field translation, but it can be achieved using an external application such as TransDb, django-multilingual, django-utils translation service and i18ndynamic. As far as I know only TransDb and django-multilingual are working on Django's trunk.
Calendar customizationNoPatching Django is required to change first day of week in admin calendar (first day of week is Monday according to ISO and in many countries (most Europe, most South America, and some parts of Asia). See ticket #1061
Date format (when displaying)YesDates displayed in admin are formatted according to current locale. Also custom dates can be easily formatted using date filter (f.e. {{ my_date|date:_("DATE_FORMAT") }} ).

The problem here, is that few internationalized formats are defined inside django, so using django formats you can internationalize a date with format "December 31th, 2000", but not with format "12/31/2000". It can be achieved creating date formats in your catalog.

Date format (on inputs)NoDjango allows specifying one or many input formats for a date form field (using the input_formats parameter of the form field).I think that there is no way to specify the format on the admin fields, specially because the format that generates the calendar is always the same.

Anyway what it's expected is not to specify the format of a field, actually it is to get the format from the current locale.

Number format (when displaying)NoDjango has just a filter (floatformat) to format numbers, where you can specify how many decimals you want. It's very difficult to customize your number format, to the format of the current locale, and even to a fixed format.
Number format (on input)NoDjango has no way to specify if you want to enter a decimal number with comma separator (dot is always used). Of course it can't be done according to current locale.

9 comments:

  1. i'm in China, it's exactly what i'm going through.
    hope to see your patch soon, thanks a lot~

    ReplyDelete
  2. The link to TransDb is broken.

    ReplyDelete
  3. I have created a small app that helps with the internationalizing of date output:

    http://code.google.com/p/django-localdates/

    It can help languages who are not covered by the standard Django date placeholders (for example, any language that uses declinations).

    There is support for Greek, Russian and Finnish, but writing support for your own language is usually just a matter of creating a messages file. More complex languages may have to define their own placeholders, but that's easy too!

    ReplyDelete
  4. Zahari, thanks for pointing me out. Now is already fixed.

    Orestis, thanks for letting me know about your project, I found it very interesting, and I think that could be useful for some problems that we also have in Catalan (not exactly the same than in greek, but we have to add a preposition to the month, depending on the context).

    Anyway, I'm not going to deal with it in my first patch, so a lot of work is missing, and this subject is too much big. But I'll keep it in mind, and your project will be very useful then, go on with it.

    ReplyDelete
  5. I'm using Babel (http://babel.edgewall.org/) for my l10n display purposes and it works exceptionally well. Thanks to this tool I was able to serve the same application for Germany, UK, Romania, Hungary and Ukraine. This overcomes any problems with formatting (dates an numbers).

    ReplyDelete
  6. zgoda, I like babel, but I don't think that babel can deal with some of the stuff that I reported. For example changing the first day of the admin's calendar.

    And Django's purpose is making web development easier, so having to integrate babel, when everything could work automatically, it's not the best option.

    Anyway thanks for the comment; while i18n isn't working on Django, Babel is a great option.

    ReplyDelete
  7. I agree that django needs better i18n support. It probably won't happen before 1.0. I hope they start fixing it soon. Admin interface translation is beautifully made.

    ReplyDelete
  8. Hey Marc, com tens el projecte? Has avançat algo aquest setembre? Com podem veure els teus canvis?

    Moltes gràcies!

    Hey Marc, what is the status of the project? Do you worked in this september? How we can see your changes?

    Thanks!

    ReplyDelete
  9. El projecte ja està acabat. Finalment només ha inclós tot el tema dels formats, res de traduccions a la db. El codi està a l'espera de que el revisi algun core, i el fiquin a trunk. De mentre el pots provar/usar a:
    http://code.djangoproject.com/browser/django/branches/soc2009/i18n-improvements

    ReplyDelete