R
R
Rrooom2014-11-05 17:15:39
Django
Rrooom, 2014-11-05 17:15:39

How to work with localization in Django?

For the first time I had to make a multilingual site.
And I'm somewhat confused (off. documentation only exacerbated the matter).
What is the difference in localization and internationalization?
How it's done?
I'm currently at a stage where almost all strings in the application are wrapped in {% trans %} and ugettext_lazy. What should I do now?
I think I found the command ./manage.py makemessages -l fr Does
it create files for translations that need to be translated first and then compiled? Where do you get language codes from?
How does Django decide which localization to push? How to manage it manually?
It is somehow written in the docks ... What needs to be done, but why and how to live with it later ...
Maybe there is a more detailed description of the process somewhere?
UPD.
Continued searching. And nothing works. How to switch the localization, I did not find. I went to the shell - there was an example in the docks.
./manage.py makemessages -l fr
Translated a couple of sentences.
./manage.py compilemessages
And in the shell:

from django.utils.translation import activate
activate('fr')
from django.utils.translation import ugettext
ugettext('Discussions')

And the translation, unfortunately, was not picked up. What didn't I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2014-11-05
@ROR191505

Where is the locale folder?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question