i18n.py 477 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import gettext
from gettext import gettext as _
import os

def C_(ctx, s):
    """Provide qualified translatable strings via context.
    (copied from Orca)"""
    translated = gettext.gettext('%s\x04%s' % (ctx, s))
    if '\x04' in translated:
        # no translation found, return input string
        return s
    return translated

gettext.bindtextdomain ("caribou",
                        os.path.join ("/usr/local", "share", "locale"))

gettext.textdomain("caribou")