Questions tagged [django-i18n]

Django internationalization provides developers with the ability to build web applications and provide content in multiple languages and locales.

Django internationalization provides developers with the ability to build web applications and provide content in multiple languages and locales.

For text translations, the Django developer can accomplish this goal by adding a minimal amount of hooks to Python and templates. These hooks are called translation strings. They tell Django: “This text should be translated into the end user’s language, if a translation for this text is available in that language.”

Internationalization is achieved in three steps:

  1. Embed translation strings in your Python code and templates.
  2. Get translations for those strings, in whichever languages you want to support.
  3. Activate the locale middleware in your Django settings.
359 questions
0
votes
1 answer

Webpack TypeScript and xgettext translations

I have a Django app and am using Django's i18n module to help translating my strings. For translating JavaScript, I run python manage.py makemessages -d djangojs which adds all marked strings to a .po file. This works quite well for all my boring…
Eldamir
  • 9,888
  • 6
  • 52
  • 73
0
votes
1 answer

Translate country names to match browser language preference

I want Azerbaijan to show up in the browser as as Azerbaïdjan (French spelling). 1) I placed the django_countries dir (downloaded from https://pypi.python.org/pypi/django-countries) in my project root. 2) added "django_countries" to my…
0
votes
2 answers

How to change language in django-modeltranslation in function

I am using django-modeltranslation for translation some fields in my models. The package works great, everything is translated. But there is no easy method to switch language manually. From reading Accessing Translated and Translation…
vishes_shell
  • 22,409
  • 6
  • 71
  • 81
0
votes
1 answer

Django UpdateView: translate form labels

I created a rather simple form using Django's UpdateView class, however, now that I want it's labels to be translated into other languages, I can't figure out how to do that. Here is the code of the view class: class EntityUpdate(UpdateView): …
Ibolit
  • 9,218
  • 7
  • 52
  • 96
0
votes
1 answer

URL rendered as home_page after internationalization

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…
J0ANMM
  • 7,849
  • 10
  • 56
  • 90
0
votes
1 answer

Django gettext doesn't works

I try to serve my django-cms website in multiple languages makemessages and compilemessages works like a charm, but when I runserver , my strings stay untranslated The python files where i used ugettext_lazy: from cms.toolbar_pool import…
Varkal
  • 1,336
  • 2
  • 16
  • 31
0
votes
1 answer

How to translate certain string from lib?

django-registration is missing some translations for german. See github Search for "". Translations are were but "broken". I don't want to fork or change localization files localy. Is it possible to provide translation for some strings in my…
Stefan Weiss
  • 461
  • 1
  • 6
  • 20
0
votes
1 answer

python Url translation on django authentication

this is a url after sign out localhost:8000/en/Users/sign-in/?next=/en/Users/ but if i change language preference and log in language doesn't change because when i change language preference url…
0
votes
1 answer

Django i18n's makemessages doesn't find .djhtml and .djt templates

I'm using i18n on Django to make my website multilingual. I've recently changed my templates' extensions from html to djhtml, so that Emacs will do syntax highlighting, but after this change, python manage.py makemessages doesn't find the djhtml…
Fabio
  • 3,015
  • 2
  • 29
  • 49
0
votes
1 answer

How to handle Django templates in Transifex?

Transifex is widely used to manage translation for Django projects, as well as internally. It does very well on gettext (PO) files. Django templates, however, are not one of its known formats. You can tell Transifex that they are HTML, in which case…
Scott Deerwester
  • 3,503
  • 4
  • 33
  • 56
0
votes
1 answer

How to keep a form's entered values when the user changes the website language via Django's i18n/setlang?

I'm using Django 1.9.9 with the i18n set_language view to change website languages. I have some pages with forms on them, e.g. for collecting project-specific user data. When a user enters data into such a form, but changes the language before…
0
votes
1 answer

Django translations not showing from app's po

I've been developing an application which works in English or French (Canadian). Django settings are; LANGUAGE_CODE = 'en' LANGUAGES = [ ('en', gettext('English')), ('fr-ca', gettext('Canadian French')), ] LOCALE_PATHS = ( ... …
markwalker_
  • 12,078
  • 7
  • 62
  • 99
0
votes
1 answer

What is the use of gettext when django explicitly translates from .po and .mo files?

While I study Internationalisation and Localisation in Django, I am told to install gettext application in my windows. But I can see that the translation is done by the django with the translation strings that we type in .po files. So I can…
Yogi
  • 1,561
  • 5
  • 26
  • 45
0
votes
1 answer

Getting 403 (Forbidden) when trying to send POST to set_language view in Django

I'm new to Django and am trying to create a small website where I click on a flag and the language changes. I'm using django i18n for that: urls.py from django.conf.urls import patterns, include, url from django.conf.urls.i18n import…
msTOM
  • 11
  • 1
0
votes
2 answers

Django Internationalization (I18N) not changing text

I created an simple website to test internationalization, but I can't make it work the way I wanted. I would like to change messages in my views.py without checking the request.LANGUAGE_CODE (which is showing correctly). I can go to the urls with…
renno
  • 2,659
  • 2
  • 27
  • 58