Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.1, 1.9.2, and 1.9.3

Merge with stable

Changeset 15a01378108e

Parents 29d55ebfc8af

Parents c1af6d4db9cd

by Steve Borho

Changes to 2 files · Browse files at 15a01378108e Showing diff from parent 29d55ebfc8af c1af6d4db9cd Diff from another changeset...

 
55
56
57
58
59
 
60
61
62
 
55
56
57
 
 
58
59
60
61
@@ -55,8 +55,7 @@
  if self.__error_text__ == None:   text = '{{{\n#!python\n' # Wrap in Bitbucket wiki preformat markers   text += _('** Please report this bug to' - ' http://bitbucket.org/tortoisehg/stable/issues or' - ' tortoisehg-discuss@lists.sourceforge.net\n') + ' http://bitbucket.org/tortoisehg/stable/issues\n')   text += '** Mercurial version (%s). TortoiseHg version (%s)\n' % (   hglib.hgversion, version.version())   text += '** Command: %s\n' % (self.opts['cmd'])
 
13
14
15
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
20
21
 
34
35
36
37
38
 
 
 
39
40
41
 
13
14
15
 
 
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
45
46
47
 
 
48
49
50
51
52
53
@@ -13,9 +13,20 @@
 def _defaultlanguage():   if os.name != 'nt' or util.any(e in os.environ for e in _localeenvs):   return # honor posix-style env var - # On Windows, system locale is provided by getdefaultlocale(), but - # gettext doesn't take it into account. - return locale.getdefaultlocale()[0] + + # On Windows, UI language can be determined by GetUserDefaultUILanguage(), + # but gettext doesn't take it into account. + # Note that locale.getdefaultlocale() uses GetLocaleInfo(), which may be + # different from UI language. + # + # For details, please read "User Interface Language Management": + # http://msdn.microsoft.com/en-us/library/dd374098(v=VS.85).aspx + try: + from ctypes import windll # requires Python>=2.5 + langid = windll.kernel32.GetUserDefaultUILanguage() + return locale.windows_locale[langid] + except (ImportError, AttributeError, KeyError): + pass    def setlanguage(lang=None):   """Change translation catalog to the specified language""" @@ -34,8 +45,9 @@
  basedir = paths.get_locale_path()   def mopath(lang):   return os.path.join(basedir, lang, 'LC_MESSAGES', 'tortoisehg.mo') - return tuple(sorted(e for e in os.listdir(basedir) - if os.path.exists(mopath(e)))) + langs = [e for e in os.listdir(basedir) if os.path.exists(mopath(e))] + langs.append('en') # means null translation + return sorted(langs)    def _(message):   return t.gettext(message)