django-i18n

I18n stopped working

一世执手 提交于 2019-12-06 01:05:48
问题 I always use this script to compile django.po and it was always working: #!/bin/sh django-admin.py makemessages -a django-admin.py compilemessages Suddenly it stopped working, with this error: $ i18n.sh Traceback (most recent call last): File "c:/Python34/Scripts/django-admin.py", line 5, in <module> management.execute_from_command_line() File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line utility.execute() File "c:\Python34\lib\site

How does email translation work with django allauth?

流过昼夜 提交于 2019-12-05 18:23:57
I'm using the most excellent django-allauth to handle authentication. All is well, but I have an issue with the email translations. First, allauth is definitely using my template. I ran: django-admin.py makemessages -l ir -i settings.py This created: my_app/locale/ir/LC_MESSAGES/django.po In django.po, I make this change: templates/account/email/email_confirmation_subject.txt:3 msgid "Confirm E-mail Address" msgstr "FARSI Confirm E-mail Address" Then to test, a user signs up on a page where the language is set (), but the email sent is not using what I put in the msgstr above. I'd like to know

Empty catalog when internationalizing JavaScript code

天涯浪子 提交于 2019-12-05 02:16:13
I'm trying to set up Internationalization of JavaScript code in my Django application . My Django app has a locale subdirectory with a properly generated djangojs.po file. The package definition is as follows: # urls.py js_info_dict = { 'packages': ('my_project',), } ./manage.py makemessages worked well as the .po file contains all the to-be-translated strings but no JavaScript string ever gets translated on the website and the catalog is always empty. I also had some problems with. This is how it works for me: Add this to yr root urls.py: js_info_dict = { 'domain': 'djangojs', 'packages': (

How can I change Django admin language?

我只是一个虾纸丫 提交于 2019-12-05 01:40:54
I have a django 1.6 site with i18n working. I can change the frontend language with a select box in the top of the template, but I don't know if there is a django app or trick to change the admin language, because it seems to store somewhere in session variable, and it keeps the first language I have used in the frontend. You can create /en/admin , /fr/admin/ and so on using i18n_patterns : urlpatterns += i18n_patterns( url(r'^admin/', include(admin.site.urls)), ) (For Django <= 1.7, you must specify a prefix, use i18n_patterns('', ... ) ) Edditado In your settings.py just add 'django

Django: change app language programmatically (without /i18n/setlang/ view)

▼魔方 西西 提交于 2019-12-04 18:42:06
My situation is the following: I'm developing a multi-language site and currently I use the Django view /i18n/setlang/ to let user switch language from a dropdown menu, and all works fine… but now, I wish to set the language programmatically, specifically I have a form with a series of settings and, among these, there is a "favorite language" voice, once the user submit the form, my view saves the User model and theoretically after that it should set the application language using the saved preference, but it does not work. What I tried is: from django.utils.translation import activate

Django internationalization: prefix_default_language & language redirect

℡╲_俬逩灬. 提交于 2019-12-04 18:10:35
I'm adding internationalization to my Django project. The idea of how it should work is the following: When a user enters "/" i.e. the "homepage" we try to get his/her language preferences from our session. If it's not our default language (EN), we redirect the user to the local version, like /ES/, /RU/, /CN/, etc If we have no such session data, we check Accept-Language and redirect the user to the local version if we support such If we don't support user's Accept-Language OR if it's EN - we don't redirect user! we just show the "default language" I.e. all "not default languages" should have

AppRegistryNotReady: The translation infrastructure cannot be initialized

你。 提交于 2019-12-04 16:00:07
问题 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 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os

Collecting messages from 3rd party apps in Django

冷暖自知 提交于 2019-12-04 07:51:10
How can I generate messages (manage.py makemessages) from 3rd party library which is located in virtualenv directory? I tried simply add the messages to the .po file, but everytime I run makemessages command my translation vanishes. Many thanks manage.py makemessages looks only for directories under the current dir. So you have to create symlink from 3rd party app to your project's directory: ln -s ~/.virtualenvs/myvenv/local/lib/python2.7/site-packages/app app mkdir locale python manage.py makemessages -l cz -s Note the -s option. It forces makemessages to follow symlinks. The other caveat is

I18n stopped working

别说谁变了你拦得住时间么 提交于 2019-12-04 06:24:54
I always use this script to compile django.po and it was always working: #!/bin/sh django-admin.py makemessages -a django-admin.py compilemessages Suddenly it stopped working, with this error: $ i18n.sh Traceback (most recent call last): File "c:/Python34/Scripts/django-admin.py", line 5, in <module> management.execute_from_command_line() File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line utility.execute() File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line 377, in execute self.fetch_command(subcommand).run

AppRegistryNotReady: The translation infrastructure cannot be initialized

前提是你 提交于 2019-12-03 09:59:48
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 project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Projectizer.settings") from django.core.wsgi import