mercurial/i18n.py
changeset 30035 02328b5d775d
parent 29415 47fb4beb992b
child 30050 d229be12e256
equal deleted inserted replaced
30034:e4a6b439acc5 30035:02328b5d775d
    25 except NameError:
    25 except NameError:
    26     unicode = str
    26     unicode = str
    27 
    27 
    28 _languages = None
    28 _languages = None
    29 if (os.name == 'nt'
    29 if (os.name == 'nt'
    30     and 'LANGUAGE' not in os.environ
    30     and 'LANGUAGE' not in encoding.environ
    31     and 'LC_ALL' not in os.environ
    31     and 'LC_ALL' not in encoding.environ
    32     and 'LC_MESSAGES' not in os.environ
    32     and 'LC_MESSAGES' not in encoding.environ
    33     and 'LANG' not in os.environ):
    33     and 'LANG' not in encoding.environ):
    34     # Try to detect UI language by "User Interface Language Management" API
    34     # Try to detect UI language by "User Interface Language Management" API
    35     # if no locale variables are set. Note that locale.getdefaultlocale()
    35     # if no locale variables are set. Note that locale.getdefaultlocale()
    36     # uses GetLocaleInfo(), which may be different from UI language.
    36     # uses GetLocaleInfo(), which may be different from UI language.
    37     # (See http://msdn.microsoft.com/en-us/library/dd374098(v=VS.85).aspx )
    37     # (See http://msdn.microsoft.com/en-us/library/dd374098(v=VS.85).aspx )
    38     try:
    38     try:
    90             # An unknown encoding results in a LookupError.
    90             # An unknown encoding results in a LookupError.
    91             _msgcache[message] = message
    91             _msgcache[message] = message
    92     return _msgcache[message]
    92     return _msgcache[message]
    93 
    93 
    94 def _plain():
    94 def _plain():
    95     if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
    95     if ('HGPLAIN' not in encoding.environ
       
    96         and 'HGPLAINEXCEPT' not in encoding.environ):
    96         return False
    97         return False
    97     exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
    98     exceptions = encoding.environ.get('HGPLAINEXCEPT', '').strip().split(',')
    98     return 'i18n' not in exceptions
    99     return 'i18n' not in exceptions
    99 
   100 
   100 if _plain():
   101 if _plain():
   101     _ = lambda message: message
   102     _ = lambda message: message
   102 else:
   103 else: