Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
d63703f1
Kaydet (Commit)
d63703f1
authored
Kas 15, 2014
tarafından
Anton Baklanov
Kaydeden (comit)
Claude Paroz
Kas 18, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #18714 -- Added 'fuzzy' compilemessages option
üst
d1881013
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
5 deletions
+75
-5
compilemessages.py
django/core/management/commands/compilemessages.py
+4
-0
django-admin.1
docs/man/django-admin.1
+1
-1
django-admin.txt
docs/ref/django-admin.txt
+9
-4
1.8.txt
docs/releases/1.8.txt
+3
-0
django.po
tests/i18n/commands/locale/ru/LC_MESSAGES/django.po
+28
-0
test_compilation.py
tests/i18n/test_compilation.py
+30
-0
No files found.
django/core/management/commands/compilemessages.py
Dosyayı görüntüle @
d63703f1
...
@@ -43,11 +43,15 @@ class Command(BaseCommand):
...
@@ -43,11 +43,15 @@ class Command(BaseCommand):
'Can be used multiple times.'
)
'Can be used multiple times.'
)
parser
.
add_argument
(
'--exclude'
,
'-x'
,
dest
=
'exclude'
,
action
=
'append'
,
default
=
[],
parser
.
add_argument
(
'--exclude'
,
'-x'
,
dest
=
'exclude'
,
action
=
'append'
,
default
=
[],
help
=
'Locales to exclude. Default is none. Can be used multiple times.'
)
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
):
def
handle
(
self
,
**
options
):
locale
=
options
.
get
(
'locale'
)
locale
=
options
.
get
(
'locale'
)
exclude
=
options
.
get
(
'exclude'
)
exclude
=
options
.
get
(
'exclude'
)
self
.
verbosity
=
int
(
options
.
get
(
'verbosity'
))
self
.
verbosity
=
int
(
options
.
get
(
'verbosity'
))
if
options
.
get
(
'fuzzy'
):
self
.
program_options
=
self
.
program_options
+
[
'-f'
]
if
find_command
(
self
.
program
)
is
None
:
if
find_command
(
self
.
program
)
is
None
:
raise
CommandError
(
"Can't find
%
s. Make sure you have GNU gettext "
raise
CommandError
(
"Can't find
%
s. Make sure you have GNU gettext "
...
...
docs/man/django-admin.1
Dosyayı görüntüle @
d63703f1
...
@@ -21,7 +21,7 @@ script found at the top level of each Django project directory.
...
@@ -21,7 +21,7 @@ script found at the top level of each Django project directory.
.
BI
cleanup
.
BI
cleanup
Cleans
out
old
data
from
the
database
(
only
expired
sessions
at
the
moment
).
Cleans
out
old
data
from
the
database
(
only
expired
sessions
at
the
moment
).
.
TP
.
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
.
Compiles
.
po
files
to
.
mo
files
for
use
with
builtin
gettext
support
.
.
TP
.
TP
.
BI
"createcachetable ["
"tablename"
"]"
.
BI
"createcachetable ["
"tablename"
"]"
...
...
docs/ref/django-admin.txt
Dosyayı görüntüle @
d63703f1
...
@@ -165,18 +165,23 @@ the builtin gettext support. See :doc:`/topics/i18n/index`.
...
@@ -165,18 +165,23 @@ the builtin gettext support. See :doc:`/topics/i18n/index`.
Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to
Use the :djadminopt:`--locale` option (or its shorter version ``-l``) to
specify the locale(s) to process. If not provided, all locales are processed.
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
Use the :djadminopt:`--exclude` option (or its shorter version ``-x``) to
specify the locale(s) to exclude from processing. If not provided, no locales
specify the locale(s) to exclude from processing. If not provided, no locales
are excluded.
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::
Example usage::
django-admin compilemessages --locale=pt_BR
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
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
django-admin compilemessages --exclude=pt_BR --exclude=fr
django-admin compilemessages --exclude=pt_BR --exclude=fr
django-admin compilemessages -x pt_BR
django-admin compilemessages -x pt_BR
...
...
docs/releases/1.8.txt
Dosyayı görüntüle @
d63703f1
...
@@ -312,6 +312,9 @@ Management Commands
...
@@ -312,6 +312,9 @@ Management Commands
:djadminopt:`--exclude` which allows exclusion of specific locales from
:djadminopt:`--exclude` which allows exclusion of specific locales from
processing.
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`
* The :djadminopt:`--ignorenonexistent` option of the :djadmin:`loaddata`
management command now ignores data for models that no longer exist.
management command now ignores data for models that no longer exist.
...
...
tests/i18n/commands/locale/ru/LC_MESSAGES/django.po
0 → 100644
Dosyayı görüntüle @
d63703f1
# 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 "Водка"
tests/i18n/test_compilation.py
Dosyayı görüntüle @
d63703f1
# -*- coding: utf-8 -*-
import
os
import
os
import
shutil
import
shutil
import
stat
import
stat
import
sys
import
sys
import
unittest
import
unittest
import
gettext
as
gettext_module
from
django.core.management
import
call_command
,
CommandError
,
execute_from_command_line
from
django.core.management
import
call_command
,
CommandError
,
execute_from_command_line
from
django.core.management.utils
import
find_command
from
django.core.management.utils
import
find_command
from
django.test
import
SimpleTestCase
from
django.test
import
SimpleTestCase
from
django.test
import
override_settings
from
django.test
import
override_settings
from
django.utils
import
translation
from
django.utils
import
translation
from
django.utils.translation
import
ugettext
from
django.utils.encoding
import
force_text
from
django.utils._os
import
upath
from
django.utils._os
import
upath
from
django.utils.six
import
StringIO
from
django.utils.six
import
StringIO
...
@@ -188,3 +193,28 @@ class CompilationErrorHandling(MessageCompilationTests):
...
@@ -188,3 +193,28 @@ class CompilationErrorHandling(MessageCompilationTests):
def
test_error_reported_by_msgfmt
(
self
):
def
test_error_reported_by_msgfmt
(
self
):
with
self
.
assertRaises
(
CommandError
):
with
self
.
assertRaises
(
CommandError
):
call_command
(
'compilemessages'
,
locale
=
[
self
.
LOCALE
],
stdout
=
StringIO
())
call_command
(
'compilemessages'
,
locale
=
[
self
.
LOCALE
],
stdout
=
StringIO
())
class
FuzzyTranslationTest
(
MessageCompilationTests
):
LOCALE
=
'ru'
MO_FILE
=
'locale/
%
s/LC_MESSAGES/django.mo'
%
LOCALE
def
setUp
(
self
):
super
(
FuzzyTranslationTest
,
self
)
.
setUp
()
self
.
addCleanup
(
self
.
rmfile
,
os
.
path
.
join
(
self
.
test_dir
,
self
.
MO_FILE
))
gettext_module
.
_translations
=
{}
# flush cache or test will be useless
def
test_nofuzzy_compiling
(
self
):
with
override_settings
(
LOCALE_PATHS
=
(
os
.
path
.
join
(
self
.
test_dir
,
'locale'
),)):
call_command
(
'compilemessages'
,
locale
=
[
self
.
LOCALE
],
stdout
=
StringIO
())
with
translation
.
override
(
self
.
LOCALE
):
self
.
assertEqual
(
ugettext
(
'Lenin'
),
force_text
(
'Ленин'
))
self
.
assertEqual
(
ugettext
(
'Vodka'
),
force_text
(
'Vodka'
))
def
test_fuzzy_compiling
(
self
):
with
override_settings
(
LOCALE_PATHS
=
(
os
.
path
.
join
(
self
.
test_dir
,
'locale'
),)):
call_command
(
'compilemessages'
,
locale
=
[
self
.
LOCALE
],
fuzzy
=
True
,
stdout
=
StringIO
())
with
translation
.
override
(
self
.
LOCALE
):
self
.
assertEqual
(
ugettext
(
'Lenin'
),
force_text
(
'Ленин'
))
self
.
assertEqual
(
ugettext
(
'Vodka'
),
force_text
(
'Водка'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment