Commit d63703f1 authored by Anton Baklanov's avatar Anton Baklanov Committed by Claude Paroz
Browse files

Fixed #18714 -- Added 'fuzzy' compilemessages option

parent d1881013
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,11 +43,15 @@ class Command(BaseCommand):
            'Can be used multiple times.')
        parser.add_argument('--exclude', '-x', dest='exclude', action='append', default=[],
            help='Locales to exclude. Default is none. Can be used multiple times.')
        parser.add_argument('--use-fuzzy', '-f', dest='fuzzy', action='store_true', default=False,
            help='Use fuzzy translations.')

    def handle(self, **options):
        locale = options.get('locale')
        exclude = options.get('exclude')
        self.verbosity = int(options.get('verbosity'))
        if options.get('fuzzy'):
            self.program_options = self.program_options + ['-f']

        if find_command(self.program) is None:
            raise CommandError("Can't find %s. Make sure you have GNU gettext "
+1 −1
Original line number Diff line number Diff line
@@ -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" "] [" "\-\-exclude=LOCALE" "]"
.BI "compilemessages [" "\-\-locale=LOCALE" "] [" "\-\-exclude=LOCALE" "] [" "\-\-use\-fuzzy" "]"
Compiles .po files to .mo files for use with builtin gettext support.
.TP
.BI "createcachetable [" "tablename" "]"
+9 −4
Original line number Diff line number Diff line
@@ -165,18 +165,23 @@ 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 ``-x``) to
specify the locale(s) to exclude from processing. If not provided, no locales
are excluded.

You can pass ``--use-fuzzy`` option (or ``-f``) to include fuzzy translations
into compiled files.

.. versionchanged:: 1.8

    Added ``--exclude`` and ``--use-fuzzy`` options.

Example usage::

    django-admin compilemessages --locale=pt_BR
    django-admin compilemessages --locale=pt_BR --locale=fr
    django-admin compilemessages --locale=pt_BR --locale=fr -f
    django-admin compilemessages -l pt_BR
    django-admin compilemessages -l pt_BR -l fr
    django-admin compilemessages -l pt_BR -l fr --use-fuzzy
    django-admin compilemessages --exclude=pt_BR
    django-admin compilemessages --exclude=pt_BR --exclude=fr
    django-admin compilemessages -x pt_BR
+3 −0
Original line number Diff line number Diff line
@@ -312,6 +312,9 @@ Management Commands
  :djadminopt:`--exclude` which allows exclusion of specific locales from
  processing.

* :djadmin:`compilemessages` now has a ``--use-fuzzy`` or ``-f`` option which
  includes fuzzy translations into compiled files.

* The :djadminopt:`--ignorenonexistent` option of the :djadmin:`loaddata`
  management command now ignores data for models that no longer exist.

+28 −0
Original line number Diff line number Diff line
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-03-30 12:51+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#
msgid "Lenin"
msgstr "Ленин"

#, fuzzy
msgid "Vodka"
msgstr "Водка"
Loading