Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Simon Charette, 12 years ago

Cc: charette.s@… added
Component: UncategorizedDocumentation
Keywords: localflavor added
Triage Stage: UnreviewedDesign decision needed
Version: master1.5-beta-1

The documentation should be updated to point out you don't have to have to include django.contrib.localflavor in INSTALLED_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.

comment:2 by Russell Keith-Magee, 12 years ago

Severity: NormalRelease 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 Simon Charette, 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 Claude Paroz, 12 years ago

Translations pushed, thanks Simon!

Now the documentation can be updated.

comment:5 by Claude Paroz, 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 Simon Charette, 12 years ago

Both admonitions look good to me.

@andreas_pelme, do you think this is correctly documenting the origin or the DeprecationWarningand how to get rid of it?

Thanks for submitting the patches.

comment:7 by Aymeric Augustin <aymeric.augustin@…>, 12 years ago

In e2ec7b47b3acb0338d971942ca7ffd36c2a4d8f4:

Updated documentation on localflavor translations

to account for the removal of django.contrib.localflavor in 1.6.

Refs #19482.

comment:8 by Aymeric Augustin <aymeric.augustin@…>, 12 years ago

In e2396bf1220c543ee8d15c7640481889caace61d:

[1.5.x] Updated documentation on localflavor translations

to account for the deprecation of django.contrib.localflavor in 1.5.

Refs #19482.

comment:9 by Aymeric Augustin, 12 years ago

Resolution: fixed
Status: newclosed

I wrapped up the documentation.

Thank you Simon and Claude -- you did all the hard work here!

comment:10 by Aymeric Augustin, 12 years ago

Easy pickings: unset
Triage Stage: Design decision neededAccepted
Note: See TracTickets for help on using tickets.
Back to Top