Monday, August 1, 2011

Re: USE_I18N vs. USE_L10N

Russell

Thank you for the clarification. Just a couple of questions below ...

On 1/08/2011 11:09pm, Russell Keith-Magee wrote:
> Close, but not quite.
>
> * USE_I18N turns on the availability of translations at all. If
> USE_I18N is false, all translation-related activities are no-ops.
>
> * Assuming USE_I18N is enabled, the current language can be set using
> either the browsers language header*or* using a call to a url
> activating a specific language for a session
> (django.views.i18n.set_language). Any text marked for translation will
> use the usual ugettext tools and the .mo data files to determine the
> translated text.
>
> * By default, all numbers and dates are rendered using the global
> format settings.
I can see those in django.conf.global_settings

> If USE_L10N is enabled, the formats.py file
> corresponding to the currently enabled language will be used to
> determine date/number formats.
settings.LANGUAGE_CODE determines the "currently enabled language" as
implied by the comment in the django-admin generated settings.py - if it
hasn't been set in some other way as you mention above. But looking
ahead to your next point below, should this one also say ".. and
USE_L18N is enabled .."?

>
> * If USE_L10N is enabled, but USE_I18N isn't, then the global
> language code will be used to determine the formats file that is used.

Do we need *both* USE_L10N and USE_I18N set true to give effect to
date/number formats in the "currently enabled language"?

It makes sense to me that we do. Although, I want localised formatting
long before I want translations.

Thanks

Mike

>
> * There are a couple of edge cases in form processing around L10N.
> For reasons of backwards compatibility, localized formatting isn't
> automatically turned on for the display of form data, so you have to
> turn on localize=True on every field that you want to display data in
> a localized format.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment