Django i18n: makemessages only on site level possible?

Posted by AndiDog on Stack Overflow See other posts from Stack Overflow or by AndiDog
Published on 2010-12-30T21:11:42Z Indexed on 2011/01/01 22:54 UTC
Read the original article Hit count: 293

I have several strings in my site that don't belong to any app, for example

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

or a modified authentication form used to set the locale cookie

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,.template in the site directory, it extracts the strings from all Python, .html and .template files, including those in my apps. That is because I develop my apps inside that directory:

Directory structure:

sitename
     myapp1
     myapp2

Is there any way to extract all strings that are not in my apps?

The only solution I found is to move the app directories outside the site directory structure, but I'm using bzr-externals (similar to git submodules or svn externals) so that doesn't make sense in my case.

Moving stuff that needs translation into a new app is also possible but I don't know if that is the only reasonable solution.

© Stack Overflow or respective owner

Related posts about django

Related posts about internationalization