diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-11-30 10:53:08 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-11-30 11:00:23 +0100 |
| commit | 50a8ab7cd1e611e6422a148becaec02218577d67 (patch) | |
| tree | 180cc283c7f700a343733df3f1b2d88a79a3d7d0 /docs | |
| parent | 9af7e18f3579df18625b9eda70735790f23aeb96 (diff) | |
Enabled makemessages to support several translation directories
Thanks Rémy Hubscher, Ramiro Morales, Unai Zalakain and
Tim Graham for the reviews.
Also fixes #16084.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/man/django-admin.1 | 3 | ||||
| -rw-r--r-- | docs/ref/django-admin.txt | 4 | ||||
| -rw-r--r-- | docs/releases/1.7.txt | 5 | ||||
| -rw-r--r-- | docs/topics/i18n/translation.txt | 28 |
4 files changed, 21 insertions, 19 deletions
diff --git a/docs/man/django-admin.1 b/docs/man/django-admin.1 index f1b568daf5..c72c3520b5 100644 --- a/docs/man/django-admin.1 +++ b/docs/man/django-admin.1 @@ -192,7 +192,8 @@ Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more (makemessages command). .TP .I \-\-no\-default\-ignore -Don't ignore the common private glob-style patterns 'CVS', '.*' and '*~' (makemessages command). +Don't ignore the common private glob-style patterns 'CVS', '.*', '*~' and '*.pyc' +(makemessages command). .TP .I \-\-no\-wrap Don't break long message lines into several lines (makemessages command). diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 02c6cd5851..69555dcb5c 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -557,7 +557,7 @@ Example usage:: Use the ``--ignore`` or ``-i`` option to ignore files or directories matching the given :mod:`glob`-style pattern. Use multiple times to ignore more. -These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'`` +These patterns are used by default: ``'CVS'``, ``'.*'``, ``'*~'``, ``'*.pyc'`` Example usage:: @@ -584,7 +584,7 @@ for technically skilled translators to understand each message's context. .. versionadded:: 1.6 Use the ``--keep-pot`` option to prevent Django from deleting the temporary -.pot file it generates before creating the .po file. This is useful for +.pot files it generates before creating the .po file. This is useful for debugging errors which may prevent the final language files from being created. makemigrations [<appname>] diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index 0767659540..1041edb37b 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -375,6 +375,11 @@ Internationalization in the corresponding entry in the PO file, which makes the translation process easier. +* When you run :djadmin:`makemessages` from the root directory of your project, + any extracted strings will now be automatically distributed to the proper + app or project message file. See :ref:`how-to-create-language-files` for + details. + Management Commands ^^^^^^^^^^^^^^^^^^^ diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 8a484702e7..66b9a99e21 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -1256,6 +1256,17 @@ is configured correctly). It creates (or updates) a message file in the directory ``locale/LANG/LC_MESSAGES``. In the ``de`` example, the file will be ``locale/de/LC_MESSAGES/django.po``. +.. versionchanged:: 1.7 + + When you run ``makemessages`` from the root directory of your project, the + extracted strings will be automatically distributed to the proper message + files. That is, a string extracted from a file of an app containing a + ``locale`` directory will go in a message file under that directory. + A string extracted from a file of an app without any ``locale`` directory + will either go in a message file under the directory listed first in + :setting:`LOCALE_PATHS` or will generate an error if :setting:`LOCALE_PATHS` + is empty. + By default :djadmin:`django-admin.py makemessages <makemessages>` examines every file that has the ``.html`` or ``.txt`` file extension. In case you want to override that default, use the ``--extension`` or ``-e`` option to specify the @@ -1730,24 +1741,9 @@ All message file repositories are structured the same way. They are: * ``$PYTHONPATH/django/conf/locale/<language>/LC_MESSAGES/django.(po|mo)`` To create message files, you use the :djadmin:`django-admin.py makemessages <makemessages>` -tool. You only need to be in the same directory where the ``locale/`` directory -is located. And you use :djadmin:`django-admin.py compilemessages <compilemessages>` +tool. And you use :djadmin:`django-admin.py compilemessages <compilemessages>` to produce the binary ``.mo`` files that are used by ``gettext``. You can also run :djadmin:`django-admin.py compilemessages --settings=path.to.settings <compilemessages>` to make the compiler process all the directories in your :setting:`LOCALE_PATHS` setting. - -Finally, you should give some thought to the structure of your translation -files. If your applications need to be delivered to other users and will be used -in other projects, you might want to use app-specific translations. But using -app-specific translations and project-specific translations could produce weird -problems with :djadmin:`makemessages`: it will traverse all directories below -the current path and so might put message IDs into a unified, common message -file for the current project that are already in application message files. - -The easiest way out is to store applications that are not part of the project -(and so carry their own translations) outside the project tree. That way, -:djadmin:`django-admin.py makemessages <makemessages>`, when ran on a project -level will only extract strings that are connected to your explicit project and -not strings that are distributed independently. |
