mercurial/i18n.py
changeset 51284 f15cb5111a1e
parent 51282 9d3721552b6c
child 51285 8b2ea2246a5f
equal deleted inserted replaced
51283:81224afd938d 51284:f15cb5111a1e
    69 
    69 
    70 
    70 
    71 _msgcache = {}  # encoding: {message: translation}
    71 _msgcache = {}  # encoding: {message: translation}
    72 
    72 
    73 
    73 
    74 def gettext(message):
    74 def gettext(message: bytes) -> bytes:
    75     # type: (bytes) -> bytes
       
    76     """Translate message.
    75     """Translate message.
    77 
    76 
    78     The message is looked up in the catalog to get a Unicode string,
    77     The message is looked up in the catalog to get a Unicode string,
    79     which is encoded in the local encoding before being returned.
    78     which is encoded in the local encoding before being returned.
    80 
    79 
   121     exceptions = encoding.environ.get(b'HGPLAINEXCEPT', b'').strip().split(b',')
   120     exceptions = encoding.environ.get(b'HGPLAINEXCEPT', b'').strip().split(b',')
   122     return b'i18n' not in exceptions
   121     return b'i18n' not in exceptions
   123 
   122 
   124 
   123 
   125 if _plain():
   124 if _plain():
   126     _ = lambda message: message  # type: Callable[[bytes], bytes]
   125 
       
   126     def _(message: bytes) -> bytes:
       
   127         return message
       
   128 
       
   129 
   127 else:
   130 else:
   128     _ = gettext
   131     _ = gettext