Hi,

I’m raising the issues found in ticket #16284 ( https://code.djangoproject.com/ticket/16284 ). To sum up, here is how Django currently chooses translation in jsi18n:

— It searches for a translation for the active language.
— If the above is not found, it searches for the settings.LANGUAGE_CODE translation.
– If the above is not found, it searches for English translation.

There are two problems related to this algorithm:

⒜ If source code language is other than English – for example, let it be Polish – and the programmer wants to provide English translation, then only the English .mo file is present. Therefore when Polish language is active, English translation supersedes it. ⒝ If there exists translation for settings.LANGUAGE_CODE and there is no translation for source code language, then when the latter is active, it is analogously superseded by settings.LANGUAGE_CODE translation.

The ⒜ issue could be solved by simply removing English preference (although this behavior is tested, it doesn’t seem to be documented). However this still leaves us with ⒝, which can be solved by letting Django know what is the language of translated texts. Obviously, the natural place to put that information would be the newly-created AppConfig class. An attribute named like “natural_language” could be created.

This leaves us with the question what should be done with translations from settings.LOCALE_PATHS (those are not tied to any particular app). In that case, an additional setting could be created which would serve as the natural language when determining whether those translations should be loaded. Also, it could be the default natural language for applications.

If no information is provided, Django will behave in a backwards compatible way, except perhaps removing English language preference. Does it sound like a reasonable approach? Any caveats that I missed?

Regards,
Krzysztof

--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/5307212A.1050400%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to