L
L
Lopus2017-04-19 12:57:30
Django
Lopus, 2017-04-19 12:57:30

Correct approach to organize i18n phrase structure in django?

Share your experience on how to better organize the translation of phrases in a bilingual project (Russian and English)? In order not to run into a rake in half a year, when the project will already be strongly tied to one of the options.
1. Write {% trans 'header_menu_news' %} in templates, create 2 files -ru and -en and translate the phrase into your language there
2. Write {% trans 'News' %} in templates and create only -en option, and -ru will be displayed by default (judging by the documentation, django is made for this option, but there is English by default)
3. Some other option?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
anton_lazarev, 2017-04-19
@anton_lazarev

This issue has been discussed by the community for a long time, but no one has come to a single option, so everyone uses the option to their taste. Personally, I use the second option.
Pros:
+ the translator does not need to keep two .po files open, since the text for translation is the key
+ if there is no translation for the key, then a clear value will be displayed, which in which case the user can translate, and not a stub like header_menu_news
Cons:
- if necessary change the original text, you will have to search the entire project for the use of this key and change it, although in the first option it would be enough to change only in the .po file

V
Volton, 2017-04-19
@Volton

i18n projects are better done with English in templates {% trans 'News' %}, and translations should be generated via Rosseta, Poedit or manually

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question