#19482 closed Bug (fixed)
django.contrib.localflavor in INSTALLED_APPS raises DeprecationWarning
Reported by: | Andreas Pelme | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.5-beta-1 |
Severity: | Release blocker | Keywords: | localflavor |
Cc: | charette.s@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation states that "If you want localflavor's texts to be translated, like form fields error messages, you must include django.contrib.localflavor in the INSTALLED_APPS setting, ...".
Adding django.contrib.localflavor to INSTALLED_APPS will make that module automatically imported, which will raise a deprecation warning.
The deprecation warning located in django/contrib/localflavor/init.py should probably be moved to django/contrib/localflavor/XX/init.py. That would make the deprecation warning appear when there is some actual code that is imported.
Change History (10)
comment:1 by , 12 years ago
Cc: | added |
---|---|
Component: | Uncategorized → Documentation |
Keywords: | localflavor added |
Triage Stage: | Unreviewed → Design decision needed |
Version: | master → 1.5-beta-1 |
comment:2 by , 12 years ago
Severity: | Normal → Release blocker |
---|
At the very least, this deserves consideration before we finalize 1.5, so I'm marking this as release blocker for the moment.
comment:3 by , 12 years ago
I went ahead and generated patches for the django-localflavor-xx apps.
I wrote a script that extract messages from django.contrib.localflavor
's locales, checkout all the django-localflavor
apps, generate locale catalogs if they we present in contrib, compile them and generate diffs.
Those patches ensure that installing a django-localflavor-xx app will provide the exact same translations as 'django.contrib.localflavor'
in INSTALLED_APPS
did prior to 1.5.
The script used to generate patches can be found here.
The generated patches can be found here.
comment:4 by , 12 years ago
Translations pushed, thanks Simon!
Now the documentation can be updated.
comment:5 by , 12 years ago
Here are some proposed updated snippets for localflavor documentation:
For 1.5:
Internationalization of localflavor =================================== The legacy ``localflavor`` application has its own catalog of translations, in the directory ``django/contrib/localflavor/locale``, and it's not loaded automatically like Django's general catalog in ``django/conf/locale``. If you want localflavor's texts to be translated, like form fields error messages, you must include :mod:`django.contrib.localflavor` in the :setting:`INSTALLED_APPS` setting, so the internationalization system can find the catalog, as explained in :ref:`how-django-discovers-translations`. For the newly-created ``localflavor`` applications, their behaviour is identical to any standard Django application, that is the application name (e.g. ``django_localflavor_jp``) should be present in the :setting:`INSTALLED_APPS` setting to activate the translations.
For 1.6:
Internationalization of localflavors ==================================== To activate translations for any ``localflavor`` application, it's the same procedure as with any other standard Django application, that is the application name (e.g. ``django_localflavor_jp``) should be present in the :setting:`INSTALLED_APPS` setting.
comment:6 by , 12 years ago
Both admonitions look good to me.
@andreas_pelme, do you think this is correctly documenting the origin or the DeprecationWarning
and how to get rid of it?
Thanks for submitting the patches.
comment:9 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I wrapped up the documentation.
Thank you Simon and Claude -- you did all the hard work here!
comment:10 by , 12 years ago
Easy pickings: | unset |
---|---|
Triage Stage: | Design decision needed → Accepted |
The documentation should be updated to point out you don't have to have to include
django.contrib.localflavor
inINSTALLED_APPS
.However I noticed that some localflavor apps are still missing a locale folder which might result in no translations at all.
Was there a plan to extract catalogs from
django/contrib/localflavor/locale/
to their specific localflavor app? We could easily do this using the embedded location string. I volunteer to generate patches for this given it's accepted.Should we mark this as Release blocker? It's kind of a regresssion since you either get a warning you can't get rid off or install a standalone app that has potentially no translations.