Django i18n: makemessages only possible at the site level?

I have several lines on my site that do not belong to any application, for example

{% block title %}{% trans "Login" %}{% endblock %}

or a modified authentication form used to set the cookie locale

class AuthenticationFormWithLocaleOption(AuthenticationForm):
    locale = forms.ChoiceField(choices = settings.LANGUAGES,
                               required = False,
                               initial = preselectedLocale,
                               label = _("Locale/language"))

Now, when I execute django-admin.py makemessages --all -e .html,.templatein the site directory, it extracts lines from all Python files, .html and .template, including in my applications. This is because I am developing my applications inside this directory:

Directory structure:

sitename
     myapp1
     myapp2

Is there a way to extract all rows missing from my applications?

The only solution I found was to move the application directories outside the site directory structure, but I use bzr-externals (similar to git subodules or svn externals), so this does not make sense in my case.

, , , , .

+3
1

makemessages , , , , makemessages --ignore. .

+5

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


All Articles