98
98
class TestInstall(tests.TestCase):
101
super(TestInstall, self).setUp()
102
# Restore a proper env to test translation installation
103
self.overrideAttr(i18n, '_translations', None)
100
105
def test_custom_languages(self):
101
self.addCleanup(i18n.install)
102
106
i18n.install('nl:fy')
107
# Whether we found a valid tranlsation or not doesn't matter, we got
108
# one and _translations is not None anymore.
109
self.assertIsInstance(i18n._translations,
110
i18n._gettext.NullTranslations)
104
112
def test_no_env_variables(self):
105
self.addCleanup(i18n.install)
106
113
self.overrideEnv('LANGUAGE', None)
107
114
self.overrideEnv('LC_ALL', None)
108
115
self.overrideEnv('LC_MESSAGES', None)
109
116
self.overrideEnv('LANG', None)
118
# Whether we found a valid tranlsation or not doesn't matter, we got
119
# one and _translations is not None anymore.
120
self.assertIsInstance(i18n._translations,
121
i18n._gettext.NullTranslations)
112
123
def test_disable_i18n(self):
113
124
i18n.disable_i18n()
115
self.assertTrue(isinstance(i18n._translations, i18n._gettext.NullTranslations))
126
# It's disabled, you can't install anything and we fallback to null
127
self.assertIsInstance(i18n._translations,
128
i18n._gettext.NullTranslations)
117
131
class TestTranslate(tests.TestCaseWithTransport):
124
138
"""do errors get translated?"""
126
140
tree = self.make_branch_and_tree('.')
127
self.overrideAttr(i18n, '_translations', ZzzTranslations())
129
142
workingtree.WorkingTree.open('./foo')
130
143
except errors.NotBranchError,e:
135
148
def test_topic_help_translation(self):
136
149
"""does topic help get translated?"""
137
150
from bzrlib import help
139
self.overrideAttr(i18n, '_translations', ZzzTranslations())
140
151
from StringIO import StringIO
142
153
help.help("authentication", out)