Fixed #22328 -- Added --exclude option to compilemessages and makemessages.

This commit is contained in:
Ana Krivokapic 2014-03-24 14:03:06 +01:00 committed by Loic Bistuer
parent d1f93e9c1e
commit 0707b824fe
12 changed files with 299 additions and 41 deletions

View file

@ -21,7 +21,7 @@ script found at the top level of each Django project directory.
.BI cleanup
Cleans out old data from the database (only expired sessions at the moment).
.TP
.BI "compilemessages [" "\-\-locale=LOCALE" "]"
.BI "compilemessages [" "\-\-locale=LOCALE" "] [" "\-\-exclude=LOCALE" "]"
Compiles .po files to .mo files for use with builtin gettext support.
.TP
.BI "createcachetable [" "tablename" "]"
@ -59,7 +59,7 @@ Executes
.B sqlall
for the given app(s) in the current database.
.TP
.BI "makemessages [" "\-\-locale=LOCALE" "] [" "\-\-domain=DOMAIN" "] [" "\-\-extension=EXTENSION" "] [" "\-\-all" "] [" "\-\-symlinks" "] [" "\-\-ignore=PATTERN" "] [" "\-\-no\-default\-ignore" "] [" "\-\-no\-wrap" "] [" "\-\-no\-location" "]"
.BI "makemessages [" "\-\-locale=LOCALE" "] [" "\-\-exclude=LOCALE" "] [" "\-\-domain=DOMAIN" "] [" "\-\-extension=EXTENSION" "] [" "\-\-all" "] [" "\-\-symlinks" "] [" "\-\-ignore=PATTERN" "] [" "\-\-no\-default\-ignore" "] [" "\-\-no\-wrap" "] [" "\-\-no\-location" "]"
Runs over the entire source tree of the current directory and pulls out all
strings marked for translation. It creates (or updates) a message file in the
conf/locale (in the django tree) or locale (for project and application) directory.
@ -176,6 +176,9 @@ output a full stack trace whenever an exception is raised.
.I \-l, \-\-locale=LOCALE
The locale to process when using makemessages or compilemessages.
.TP
.I \-e, \-\-exclude=LOCALE
The locale to exclude from processing when using makemessages or compilemessages.
.TP
.I \-d, \-\-domain=DOMAIN
The domain of the message files (default: "django") when using makemessages.
.TP

View file

@ -141,12 +141,22 @@ the builtin gettext support. See :doc:`/topics/i18n/index`.
Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to
specify the locale(s) to process. If not provided, all locales are processed.
.. versionadded:: 1.8
Use the :djadminopt:`--exclude` option (or its shorter version ``-e``) to
specify the locale(s) to exclude from processing. If not provided, no locales
are excluded.
Example usage::
django-admin.py compilemessages --locale=pt_BR
django-admin.py compilemessages --locale=pt_BR --locale=fr
django-admin.py compilemessages -l pt_BR
django-admin.py compilemessages -l pt_BR -l fr
django-admin.py compilemessages --exclude=pt_BR
django-admin.py compilemessages --exclude=pt_BR --exclude=fr
django-admin.py compilemessages -e pt_BR
django-admin.py compilemessages -e pt_BR -e fr
createcachetable
----------------
@ -551,12 +561,23 @@ Separate multiple extensions with commas or use -e or --extension multiple times
Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to
specify the locale(s) to process.
.. versionadded:: 1.8
Use the :djadminopt:`--exclude` option (or its shorter version ``-e``) to
specify the locale(s) to exclude from processing. If not provided, no locales
are excluded.
Example usage::
django-admin.py makemessages --locale=pt_BR
django-admin.py makemessages --locale=pt_BR --locale=fr
django-admin.py makemessages -l pt_BR
django-admin.py makemessages -l pt_BR -l fr
django-admin.py makemessages --exclude=pt_BR
django-admin.py makemessages --exclude=pt_BR --exclude=fr
django-admin.py makemessages -e pt_BR
django-admin.py makemessages -e pt_BR -e fr
.. versionchanged:: 1.7

View file

@ -128,6 +128,10 @@ Management Commands
* :djadmin:`dumpdata` now has the option :djadminopt:`--output` which allows
specifying the file to which the serialized data is written.
* :djadmin:`makemessages` and :djadmin:`compilemessages` now have the option
:djadminopt:`--exclude` which allows exclusion of specific locales from
processing.
Models
^^^^^^