In some Django applications I encountered URL patterns with gettext such as:
from django.utils.translation import ugettext as _
urlpatterns = patterns('',
...
url(r'^%s$' % _('about/'), about, name='about'),
...
)
At first, it seemed to be a good idea to have internationalized URLs in a uniform way with the rest of the project but I have doubts.
AFAIK, URL patterns are loaded at application start-up. So I suspect they will be build according to the language preferences of the user who makes the first request to the application. This may get even more unpredictable when threads are in the play too.
This approach may be reasonable for cases where an installation will be in single language but there may be other installations in other languages, like forum applications.
Do you think this is a problem or just my imagination? Can this approach be used for multilingual sites? Can ugettext_lazy
avoid this problem?