Rev 6038: (vila) Fix i18n use when no environment variables are set. (Jelmer Vernooij, in file:///home/pqm/archives/thelove/bzr/2.4/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Aug 23 19:18:24 UTC 2011
At file:///home/pqm/archives/thelove/bzr/2.4/
------------------------------------------------------------
revno: 6038 [merge]
revision-id: pqm at pqm.ubuntu.com-20110823191816-6btr7jhq3evgz020
parent: pqm at pqm.ubuntu.com-20110821133957-96uxqhhf1mtl01u2
parent: jriddell at canonical.com-20110823150557-1v96kdiu28o0f3vn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Tue 2011-08-23 19:18:16 +0000
message:
(vila) Fix i18n use when no environment variables are set. (Jelmer Vernooij,
#810701) (Jonathan Riddell)
modified:
bzrlib/i18n.py i18n.py-20110429130428-eblvodng604h3dzi-1
bzrlib/tests/test_i18n.py test_i18n.py-20110517012016-wjj0ai7qrasnj49p-1
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/i18n.py'
--- a/bzrlib/i18n.py 2011-06-30 11:14:06 +0000
+++ b/bzrlib/i18n.py 2011-08-23 15:05:57 +0000
@@ -74,10 +74,14 @@
global _translations
if lang is None:
lang = _get_current_locale()
+ if lang is not None:
+ languages = lang.split(':')
+ else:
+ languages = None
_translations = _gettext.translation(
'bzr',
localedir=_get_locale_dir(),
- languages=lang.split(':'),
+ languages=languages,
fallback=True)
=== modified file 'bzrlib/tests/test_i18n.py'
--- a/bzrlib/tests/test_i18n.py 2011-06-27 15:52:06 +0000
+++ b/bzrlib/tests/test_i18n.py 2011-08-23 15:05:57 +0000
@@ -19,8 +19,6 @@
from bzrlib import i18n, tests
-
-
class ZzzTranslations(object):
"""Special Zzz translation for debugging i18n stuff.
@@ -91,3 +89,18 @@
def test_multiline(self):
self.assertEqual(u"zz{{spam\nham}}\n\nzz{{eggs\n}}",
i18n.gettext_per_paragraph("spam\nham\n\neggs\n"))
+
+
+class TestInstall(tests.TestCase):
+
+ def test_custom_languages(self):
+ self.addCleanup(i18n.install)
+ i18n.install('nl:fy')
+
+ def test_no_env_variables(self):
+ self.addCleanup(i18n.install)
+ self.overrideEnv('LANGUAGE', None)
+ self.overrideEnv('LC_ALL', None)
+ self.overrideEnv('LC_MESSAGES', None)
+ self.overrideEnv('LANG', None)
+ i18n.install()
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-08-19 08:12:12 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-08-23 15:05:57 +0000
@@ -35,6 +35,8 @@
* ``config.LocationMatcher`` properly excludes unrelated sections.
(Vincent Ladeuil, #829237)
+* Fix i18n use when no environment variables are set. (Jelmer Vernooij, #810701)
+
Documentation
*************
More information about the bazaar-commits
mailing list