On 7/2/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > How would you feel about making a requirement that settings must be > configured prior to attempting to use translations. By this, I mean, > Django must know that it is either using DJANGO_SETTINGS_MODULE or > manual configuration prior to trying to use _(). In that case, you could > put the import into __builtins__ into LazySettings._import_settings() > and LazySettings.configure(), because you will know the value of > USE_I18N at the end of both of those methods.
That would indeed solve this, but I agree with you that it's not the best solution. Namely, we shouldn't have to require that a person use settings before using _(). > The other thing I can think of is to install a function initially that > installs the "real" function over the top of itself the first time it is > called (see attached lazy-install.py for a proof of concept). The first > time the lazy _() is called, it can check settings.USE_I18N, which will > always be accessible at that point (the first access to "settings" > configures it if it has not already been done). This, I like. The function can originally be installed in django/conf/__init__.py (where the translation.install() call currently lives), and it can load from the django.utils.translation backend appropriately. It's actually not *too* hackish, either...Well, not as much as the other solution, I guess. Any other thoughts on this from anybody? I'll go ahead and commit this some time Monday, although I'm traveling at the moment and may not get to it until Tuesday. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---
