django-i18n

Internationalization not working properly - No action seems to be happening

99封情书 提交于 2019-12-14 03:15:19
问题 I configured my setting.py as show below: LANGUAGE_CODE = 'pt-br' USE_I18N = True LANGUAGES = ( ('pt_br', ('Portugues Brasileiro')), ('en_us', ('English')) ) MIDDLEWARE_CLASSES = ( ... 'django.middleware.locale.LocaleMiddleware', ... ) LOCALE_PATHS = ('/home/lucas/Documents/ProjectPython/test_internacionalizacao/test_internacionalizacao/locale/') Created an app called core that has in its folder another folder structure as: core ---- templates -------- core ------------ core.html ------------

URL rendered as home_page after internationalization

Deadly 提交于 2019-12-12 05:29:10
问题 I have a Django Website that I am trying to internationalize. Until now it looked like this: Homepage: www.myhomepage.com Another page: www.myhomepage.com/content/cities Now I am trying to make it like this: Homepage: www.myhomepage.com/en www.myhomepage.com/de Another page: www.myhomepage.com/en/content/cities www.myhomepage.com/de/content/cities Following this and this, I managed to make the homepage work, so with www.myhomepage.com/en I see the homepage in English and with www.myhomepage

Django translation: can't find msguniq

為{幸葍}努か 提交于 2019-12-11 15:46:10
问题 I would like to do the translation inside Django application. I was following the this tutorial but I run into problems. After I run the code python manage.py makemessages -l 'de' I get the error CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed. The weird thing is, that I have the gettext already installed Warning: gettext 0.19.8.1 is already installed and up-to-date To reinstall 0.19.8.1, run `brew reinstall gettext` I have the settings set as: #

Django not translating the site properly

☆樱花仙子☆ 提交于 2019-12-11 11:34:42
问题 After spending too many hours on this, StackOverflow is for the rescue. I configured my settings.py as below: ... TIME_ZONE = 'Europe/Berlin' LANGUAGE_CODE = 'de' LANGUAGES = ( ('en', u'English'), ('de', u'German'), ('fr', u'French'), ) USE_I18N = True USE_L10N = True MIDDLEWARE_CLASSES = ( 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django

Django: Only a single element gets translated

ぃ、小莉子 提交于 2019-12-10 11:14:23
问题 Porting a Django site from 1.2 to 1.5 on Python 2.6 i ran into problems with internationalization. The wierd thing is that only one string gets translated in the entire site (Well, almost, the date filter could translate long month names when I tested). Other strings located in the same template doesn't get translated, and all translations are located in a single po/mo file. All translations are there, verified with Poedit and compiled with manage.py compilemessages . Edit: The reason for the

Empty catalog when internationalizing JavaScript code

核能气质少年 提交于 2019-12-10 02:26:36
问题 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. 回答1: I also had some problems with. This

How does email translation work with django allauth?

让人想犯罪 __ 提交于 2019-12-07 15:11:32
问题 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

How can I change Django admin language?

匆匆过客 提交于 2019-12-06 20:29:28
问题 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. 回答1: 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

Django internationalization: prefix_default_language & language redirect

主宰稳场 提交于 2019-12-06 13:15:04
问题 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

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

╄→尐↘猪︶ㄣ 提交于 2019-12-06 10:23:37
问题 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