Internationalization of Django

I have a similar problem found here. Why doesn't Django create language files from template files in another directory?

However, I do not understand the solution. My structure:

Project App1 locale templates App2 locale templates templates somefilethatneedstranslation.html 

Now when I run this command from App1:

 python ../manage.py App1 -l nl 

It nicely creates a po file for App1 templates in the App1 locale folder

However, I want my global templates to be translated as well. Note. I DO NOT want the locale folder in the root of my project, so I tried to add a symbolic link to the templates folder from App1, but it does not add the translation results to the file App1 / locale / po

from App1 folder

 ln -s ../templates/locale/* translations python ../manage.py App1 -l nl --symlinks 

What am I missing?

Note:

from templates folder

 python ../manage.py templates -l nl 

may work, but it will not be because, obviously, the templates are not an installed application, it seems that I am missing the obvious ...

+6
source share
1 answer

Full refusal message (which is also explained in the translation documents ):

Translations in the project directory are no longer supported. LOCALE_PATHS.

This post is perhaps a little obscure. Although automatic translation detection in the project directory is outdated, using LOCALE_PATHS to reference the locale folder at the project level is completely acceptable.

If you have templates at the project level, it makes no sense to translate these templates into the local application locales: save the locale directory at the project level, refer to it in LOCALE_PATHS.

+6
source

Source: https://habr.com/ru/post/900505/


All Articles