mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #21488 -- Multiple locales treatment in i18n commands.
Removed multiple locales separated by commas variation (that wasn't
working as documented) in favor of simply allowing use of the
``--locale``/``-l`` options more than once for ``makemessages`` and
``compilemessages``.
Thanks Romain Beylerian for the report and Claude, Simon for their help.
8750296918
from stable/1.6.x.
This commit is contained in:
parent
ffc37e2343
commit
62b393c5ae
6 changed files with 37 additions and 45 deletions
|
@ -33,7 +33,7 @@ class PoFileTests(MessageCompilationTests):
|
|||
|
||||
def test_bom_rejection(self):
|
||||
with self.assertRaises(CommandError) as cm:
|
||||
call_command('compilemessages', locale=self.LOCALE, stdout=StringIO())
|
||||
call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
|
||||
self.assertIn("file has a BOM (Byte Order Mark)", cm.exception.args[0])
|
||||
self.assertFalse(os.path.exists(self.MO_FILE))
|
||||
|
||||
|
@ -49,7 +49,7 @@ class PoFileContentsTests(MessageCompilationTests):
|
|||
self.addCleanup(os.unlink, os.path.join(test_dir, self.MO_FILE))
|
||||
|
||||
def test_percent_symbol_in_po_file(self):
|
||||
call_command('compilemessages', locale=self.LOCALE, stdout=StringIO())
|
||||
call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
|
||||
self.assertTrue(os.path.exists(self.MO_FILE))
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ class PercentRenderingTests(MessageCompilationTests):
|
|||
@override_settings(LOCALE_PATHS=(os.path.join(test_dir, 'locale'),))
|
||||
def test_percent_symbol_escaping(self):
|
||||
from django.template import Template, Context
|
||||
call_command('compilemessages', locale=self.LOCALE, stdout=StringIO())
|
||||
call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
|
||||
with translation.override(self.LOCALE):
|
||||
t = Template('{% load i18n %}{% trans "Looks like a str fmt spec %% o but shouldn\'t be interpreted as such" %}')
|
||||
rendered = t.render(Context({}))
|
||||
|
@ -92,7 +92,7 @@ class MultipleLocaleCompilationTests(MessageCompilationTests):
|
|||
self.addCleanup(self.rmfile, os.path.join(localedir, self.MO_FILE_FR))
|
||||
|
||||
def test_one_locale(self):
|
||||
call_command('compilemessages', locale='hr', stdout=StringIO())
|
||||
call_command('compilemessages', locale=['hr'], stdout=StringIO())
|
||||
|
||||
self.assertTrue(os.path.exists(self.MO_FILE_HR))
|
||||
|
||||
|
@ -114,4 +114,4 @@ class CompilationErrorHandling(MessageCompilationTests):
|
|||
|
||||
def test_error_reported_by_msgfmt(self):
|
||||
with self.assertRaises(CommandError):
|
||||
call_command('compilemessages', locale=self.LOCALE, stdout=StringIO())
|
||||
call_command('compilemessages', locale=[self.LOCALE], stdout=StringIO())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue