django-i18n

Django – gettext_lazy not working in string interpolation/concatenation (inside list)

Django – gettext_lazy not working in string interpolation/concatenation (inside list) Question: I have a dictionary of items with multiple properties. from django.utils.translation import ( gettext_lazy as _, ) {"item1": { "labels": [ _("label1"), "this is" + _("translatethis") + " label2", ] These items are then serialized in DRF. The problem is that _("label1") is being …

Total answers: 1

Django Locale not working after deploying to server [ FIXED ]

Django Locale not working after deploying to server [ FIXED ] Question: when i test it locally the translations do worked, but when I deploy it on a server it doesn’t work. Some of the words do get translated but it’s not from my locale, it’s django’s default translation. In settings.py: MIDDLEWARE = [ ‘django.middleware.security.SecurityMiddleware’, …

Total answers: 2

AppRegistryNotReady: The translation infrastructure cannot be initialized

AppRegistryNotReady: The translation infrastructure cannot be initialized Question: When I try to access to my app, I’m getting the following error. AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don’t make non-lazy gettext calls at import time Here is my wsgi.py file: “”” WSGI config for Projectizer …

Total answers: 9

What's the correct way to set up Django translation?

What's the correct way to set up Django translation? Question: I’ve got an issue with translations not working on Django 1.6. I’ve added this to my settings.py: LANGUAGE_CODE = ‘en-us’ ugettext = lambda s: s LANGUAGES = ( (‘en’, ugettext(‘English’)), (‘de’, ugettext(‘German’)), ) Also added middlewares: MIDDLEWARE_CLASSES = ( ‘django.middleware.common.CommonMiddleware’, ‘django.contrib.sessions.middleware.SessionMiddleware’, ‘django.middleware.csrf.CsrfViewMiddleware’, ‘django.contrib.auth.middleware.AuthenticationMiddleware’, ‘django.contrib.messages.middleware.MessageMiddleware’, ‘django.middleware.locale.LocaleMiddleware’, …

Total answers: 6

Issue trying to change language from Django template

Issue trying to change language from Django template Question: I need to include two buttons or links to allow users change language between English and Spanish. I’ve read the docs and tried this: <form action=”/i18n/setlang/” method=”post”>{% csrf_token %} <input name=”language” type=”hidden” value=”es” /> <input type=”submit” value=”ES” /> </form> However, every time I click the button, …

Total answers: 9

Django internationalization language codes

Django internationalization language codes Question: Where can I find list of languages and language_code like this. (Swedish,sv) (English,en) Asked By: Hulk || Source Answers: Wiki: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes Answered By: histrio If you want something you can use from within django, try: from django.conf import settings this will be in the format above, making it perfect for …

Total answers: 5