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
8
votes
3 answers

How do I keep whitespace between {% blocktrans %} and {% plural %} tags without causing msgfmt errors?

I'm rendering some pluralization using the blocktrans tag; here's the relevant snippet in the template file: {% blocktrans count choice_count=choice_count %} You have {{ choice_count }} choice: {% plural %} You have {{ choice_count }}…
3cheesewheel
  • 9,133
  • 9
  • 39
  • 59
8
votes
3 answers

django-multilingual and switching between languages on template side

I'm trying to use django-multilingual and setup it properly. But what I found is that everything is clear for django-multilingual except a template usage example. I just started to use django and I don't know, maybe because of this reason, I cannot…
israkir
  • 2,111
  • 7
  • 30
  • 39
7
votes
5 answers

How to translate a form in Django?

I want to translate a django form. How do I translate the labels of the fields? I tried field.label=ugettext_lazy(field.label), but the labels are not getting populated in django.po file I may have gotten the concept of ugettext_lazy wrong, I…
user1077344
7
votes
1 answer

How to setup email translation with Django Allauth

I am trying to setup translations for emails with django-allauth. I have rewritten my templates, translated my .po files and complied them. The html translations work fine but for some reason just the emails don't get translated. I have properly…
arosa
  • 371
  • 1
  • 3
  • 8
7
votes
0 answers

django I18n javascript_catalog with react weird comportment

I'm using Django 1.9, React and webpack, I used externals to load the django I18n functions such as gettext in my javascript files. This is loaded like this from a view :