diff options
| author | orlovgb <[email protected]> | 2022-02-10 16:48:20 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:20 +0300 | 
| commit | 0315e42217b6a79d49980d6139c0e487cab2426f (patch) | |
| tree | c2c9407a71b77bbc22502dddbe0516bbe7245835 /contrib/tools/python3 | |
| parent | 12d7840a194f4a6e4ea77a405f980074cf43e942 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3')
| -rw-r--r-- | contrib/tools/python3/src/Lib/gettext.py | 24 | 
1 files changed, 12 insertions, 12 deletions
diff --git a/contrib/tools/python3/src/Lib/gettext.py b/contrib/tools/python3/src/Lib/gettext.py index 9df74c91f00..41c86fbf11e 100644 --- a/contrib/tools/python3/src/Lib/gettext.py +++ b/contrib/tools/python3/src/Lib/gettext.py @@ -49,12 +49,12 @@ internationalized, to the local language and cultural habits.  import os  import re  import sys -import io +import io  -try: -    import __res -except ImportError: -    __res = None +try:  +    import __res  +except ImportError:  +    __res = None   __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',             'find', 'translation', 'install', 'textdomain', 'bindtextdomain', @@ -572,7 +572,7 @@ def find(domain, localedir=None, languages=None, all=False):          if lang == 'C':              break          mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain) -        if __res and __res.resfs_src(mofile.encode('utf-8'), resfs_file=True) or os.path.exists(mofile): +        if __res and __res.resfs_src(mofile.encode('utf-8'), resfs_file=True) or os.path.exists(mofile):               if all:                  result.append(mofile)              else: @@ -603,12 +603,12 @@ def translation(domain, localedir=None, languages=None,          key = (class_, os.path.abspath(mofile))          t = _translations.get(key)          if t is None: -            mores = __res and __res.resfs_read(mofile.encode('utf-8')) -            if mores: -                t = _translations.setdefault(key, class_(io.BytesIO(mores))) -            else: -                with open(mofile, 'rb') as fp: -                    t = _translations.setdefault(key, class_(fp)) +            mores = __res and __res.resfs_read(mofile.encode('utf-8'))  +            if mores:  +                t = _translations.setdefault(key, class_(io.BytesIO(mores)))  +            else:  +                with open(mofile, 'rb') as fp:  +                    t = _translations.setdefault(key, class_(fp))           # Copy the translation object to allow setting fallbacks and          # output charset. All other instance data is shared with the          # cached object.  | 
