We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 722d822 commit b4c7a17Copy full SHA for b4c7a17
bpython/translations.py
@@ -1,4 +1,19 @@
1
+import os.path
2
import gettext
3
-translation = gettext.translation('bpython')
4
-_ = translation.ugettext
+try:
5
+ translation = gettext.translation('bpython')
6
+except IOError:
7
+ # try to load .mo files created with 'python setup.py build_translation'
8
+ # from the build/ directory
9
+ try:
10
+ translation = gettext.translation('bpython',
11
+ os.path.join('build', 'share', 'locale'))
12
+ except IOError:
13
+ translation = None
14
+
15
+if translation is None:
16
+ def _(s):
17
+ return s
18
+else:
19
+ _ = translation.ugettext
0 commit comments