Rev 6026: (jelmer) Fix i18n installation when no language environment variables are in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jul 15 01:05:57 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6026 [merge]
revision-id: pqm at pqm.ubuntu.com-20110715010556-ed5ksz52tkean7oa
parent: pqm at pqm.ubuntu.com-20110714135221-785gbmtlr9zmlifl
parent: jelmer at samba.org-20110714221452-hd1yap5lgdbsjyx3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-07-15 01:05:56 +0000
message:
  (jelmer) Fix i18n installation when no language environment variables are
   set. (Jelmer Vernooij)
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-07-14 22:14:52 +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-07-14 22:14:52 +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-07-11 08:53:59 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-07-14 22:14:52 +0000
@@ -32,6 +32,8 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* Fix i18n use when no environment variables are set. (Jelmer Vernooij, #810701)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list