~jelmer/brz/osutils-fstype

« back to all changes in this revision

Viewing changes to breezy/i18n.py

  • Committer: Jelmer Vernooij
  • Date: 2018-12-18 20:58:51 UTC
  • mfrom: (7122.3.101 work)
  • Revision ID: jelmer@jelmer.uk-20181218205851-wsq5crtfn88zn2an
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import os
29
29
import sys
30
30
 
31
 
from .sixish import text_type
32
 
 
33
31
 
34
32
_translations = None
35
33
 
36
34
 
37
35
def gettext(message):
38
 
    """Translate message. 
39
 
    
 
36
    """Translate message.
 
37
 
40
38
    :returns: translated message as unicode.
41
39
    """
42
40
    install()
101
99
 
102
100
def install_translations(lang=None, domain='brz', locale_base=None):
103
101
    """Create a gettext translation object.
104
 
    
 
102
 
105
103
    :param lang: language to install.
106
104
    :param domain: translation domain to install.
107
105
    :param locale_base: plugins can specify their own directory.
115
113
    else:
116
114
        languages = None
117
115
    translation = _gettext.translation(
118
 
            domain,
119
 
            localedir=_get_locale_dir(locale_base),
120
 
            languages=languages,
121
 
            fallback=True)
 
116
        domain,
 
117
        localedir=_get_locale_dir(locale_base),
 
118
        languages=languages,
 
119
        fallback=True)
122
120
    return translation
123
121
 
124
122
 
147
145
        decode_path = str
148
146
    else:
149
147
        fs_enc = sys.getfilesystemencoding()
 
148
 
150
149
        def decode_path(path):
151
150
            return path.decode(fs_enc)
152
151
    if getattr(sys, 'frozen', False):
212
211
    """
213
212
    locale_base = os.path.dirname(__file__)
214
213
    translation = install_translations(domain=domain,
215
 
        locale_base=locale_base)
 
214
                                       locale_base=locale_base)
216
215
    add_fallback(translation)
217
216
    return translation