In some Django applications, I found URL patterns with gettext, for example:
from django.utils.translation import ugettext as _ urlpatterns = patterns('', ... url(r'^%s$' % _('about/'), about, name='about'), ... )
Firstly, it would be nice to have universal URLs in the same way with the rest of the project, but I have doubts.
AFAIK, URL patterns are loaded when the application starts. Therefore, I suspect that they will be created in accordance with the language preferences of the user who makes the first request to the application. This can become even more unpredictable when threads are also in the game.
This approach may be reasonable in cases where the installation will be in one language, but there may be other installations in other languages, for example, in forums.
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?
source share