summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2015-04-16 12:55:37 +0100
committerTim Graham <timograham@gmail.com>2015-06-04 21:02:02 -0400
commit40f0a84cb151669313faadf857aaddd18d39aaeb (patch)
treefcfa0aea3ee68d0c17dfa91679e0d6b6fb14af81 /tests
parent7bda2d8ebc7833747363ac837fecb6535c817dcd (diff)
Fixed #24159 -- Made compilemessages run across all apps.
Updated the command to match the documentation, which states it runs over all .po files.
Diffstat (limited to 'tests')
-rw-r--r--tests/i18n/commands/app_with_locale/locale/ru/LC_MESSAGES/django.po28
-rw-r--r--tests/i18n/test_compilation.py23
2 files changed, 47 insertions, 4 deletions
diff --git a/tests/i18n/commands/app_with_locale/locale/ru/LC_MESSAGES/django.po b/tests/i18n/commands/app_with_locale/locale/ru/LC_MESSAGES/django.po
new file mode 100644
index 0000000000..ae23e448a3
--- /dev/null
+++ b/tests/i18n/commands/app_with_locale/locale/ru/LC_MESSAGES/django.po
@@ -0,0 +1,28 @@
+# 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 "Водка"
diff --git a/tests/i18n/test_compilation.py b/tests/i18n/test_compilation.py
index 682885bec8..df2911868e 100644
--- a/tests/i18n/test_compilation.py
+++ b/tests/i18n/test_compilation.py
@@ -192,14 +192,21 @@ class CompilationErrorHandling(MessageCompilationTests):
call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
-class FuzzyTranslationTest(MessageCompilationTests):
-
+class ProjectAndAppTests(MessageCompilationTests):
LOCALE = 'ru'
- MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
+ PROJECT_MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
+ APP_MO_FILE = 'app_with_locale/locale/%s/LC_MESSAGES/django.mo' % LOCALE
+
+ def setUp(self):
+ super(ProjectAndAppTests, self).setUp()
+ self.addCleanup(self.rmfile, os.path.join(self.test_dir, self.PROJECT_MO_FILE))
+ self.addCleanup(self.rmfile, os.path.join(self.test_dir, self.APP_MO_FILE))
+
+
+class FuzzyTranslationTest(ProjectAndAppTests):
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):
@@ -215,3 +222,11 @@ class FuzzyTranslationTest(MessageCompilationTests):
with translation.override(self.LOCALE):
self.assertEqual(ugettext('Lenin'), force_text('Ленин'))
self.assertEqual(ugettext('Vodka'), force_text('Водка'))
+
+
+class AppCompilationTest(ProjectAndAppTests):
+
+ def test_app_locale_compiled(self):
+ call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
+ self.assertTrue(os.path.exists(self.PROJECT_MO_FILE))
+ self.assertTrue(os.path.exists(self.APP_MO_FILE))