equal
deleted
inserted
replaced
18 if getattr(sys, 'frozen', None) is not None: |
18 if getattr(sys, 'frozen', None) is not None: |
19 module = sys.executable |
19 module = sys.executable |
20 else: |
20 else: |
21 module = __file__ |
21 module = __file__ |
22 |
22 |
|
23 try: |
|
24 unicode |
|
25 except NameError: |
|
26 unicode = str |
23 |
27 |
24 _languages = None |
28 _languages = None |
25 if (os.name == 'nt' |
29 if (os.name == 'nt' |
26 and 'LANGUAGE' not in os.environ |
30 and 'LANGUAGE' not in os.environ |
27 and 'LC_ALL' not in os.environ |
31 and 'LC_ALL' not in os.environ |
43 |
47 |
44 def setdatapath(datapath): |
48 def setdatapath(datapath): |
45 localedir = os.path.join(datapath, 'locale') |
49 localedir = os.path.join(datapath, 'locale') |
46 t = gettextmod.translation('hg', localedir, _languages, fallback=True) |
50 t = gettextmod.translation('hg', localedir, _languages, fallback=True) |
47 global _ugettext |
51 global _ugettext |
48 _ugettext = t.ugettext |
52 try: |
|
53 _ugettext = t.ugettext |
|
54 except AttributeError: |
|
55 _ugettext = t.gettext |
49 |
56 |
50 _msgcache = {} |
57 _msgcache = {} |
51 |
58 |
52 def gettext(message): |
59 def gettext(message): |
53 """Translate message. |
60 """Translate message. |