/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/i18n.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
"""i18n and l10n support for Bazaar."""
24
24
 
 
25
from __future__ import absolute_import
 
26
 
25
27
import gettext as _gettext
26
28
import os
27
29
import sys
139
141
 
140
142
    :param base: plugins can specify their own local directory
141
143
    """
 
144
    if sys.version_info > (3,):
 
145
        decode_path = str
 
146
    else:
 
147
        fs_enc = sys.getfilesystemencoding()
 
148
 
 
149
        def decode_path(path):
 
150
            return path.decode(fs_enc)
142
151
    if getattr(sys, 'frozen', False):
143
152
        if base is None:
144
 
            base = os.path.dirname(sys.executable)
 
153
            base = os.path.dirname(decode_path(sys.executable))
145
154
        return os.path.join(base, u'locale')
146
155
    else:
147
156
        if base is None:
148
 
            base = os.path.dirname(__file__)
 
157
            base = os.path.dirname(decode_path(__file__))
149
158
        dirpath = os.path.realpath(os.path.join(base, u'locale'))
150
159
        if os.path.exists(dirpath):
151
160
            return dirpath
152
 
    return os.path.join(sys.prefix, u"share", u"locale")
 
161
    return os.path.join(decode_path(sys.prefix), u"share", u"locale")
153
162
 
154
163
 
155
164
def _check_win32_locale():