Mercurial > public > mercurial-scm > hg
diff mercurial/i18n.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | c59eb1560c44 |
line wrap: on
line diff
--- a/mercurial/i18n.py Sun Oct 06 09:45:02 2019 -0400 +++ b/mercurial/i18n.py Sun Oct 06 09:48:39 2019 -0400 @@ -26,10 +26,10 @@ _languages = None if ( pycompat.iswindows - and 'LANGUAGE' not in encoding.environ - and 'LC_ALL' not in encoding.environ - and 'LC_MESSAGES' not in encoding.environ - and 'LANG' not in encoding.environ + and b'LANGUAGE' not in encoding.environ + and b'LC_ALL' not in encoding.environ + and b'LC_MESSAGES' not in encoding.environ + and b'LANG' not in encoding.environ ): # Try to detect UI language by "User Interface Language Management" API # if no locale variables are set. Note that locale.getdefaultlocale() @@ -83,7 +83,7 @@ else: # should be ascii, but we have unicode docstrings in test, which # are converted to utf-8 bytes on Python 3. - paragraphs = [p.decode("utf-8") for p in message.split('\n\n')] + paragraphs = [p.decode("utf-8") for p in message.split(b'\n\n')] # Be careful not to translate the empty string -- it holds the # meta data of the .po file. u = u'\n\n'.join([p and _ugettext(p) or u'' for p in paragraphs]) @@ -103,12 +103,12 @@ def _plain(): if ( - 'HGPLAIN' not in encoding.environ - and 'HGPLAINEXCEPT' not in encoding.environ + b'HGPLAIN' not in encoding.environ + and b'HGPLAINEXCEPT' not in encoding.environ ): return False - exceptions = encoding.environ.get('HGPLAINEXCEPT', '').strip().split(',') - return 'i18n' not in exceptions + exceptions = encoding.environ.get(b'HGPLAINEXCEPT', b'').strip().split(b',') + return b'i18n' not in exceptions if _plain():