Ejemplo n.º 1
0
    def _(x):
        if x == '':  # Workaround for gettext's behaviour on empty strings
            return ''

        result = gettext.lgettext(x)
        if isinstance(result, bytes):
            return result.decode(sys.getdefaultencoding())
        else:
            return result
Ejemplo n.º 2
0
    def _(x):
        if x == '':  # Workaround for gettext's behaviour on empty strings
            return ''

        result = gettext.lgettext(x)
        if isinstance(result, bytes):
            return result.decode(sys.getdefaultencoding())
        else:
            return result
Ejemplo n.º 3
0
import os
import six


def _find_locale_files():
    module_path = os.path.abspath(__file__)
    locale_path = os.path.join(os.path.dirname(module_path), 'locale')

    gettext.bindtextdomain("pykickstart", locale_path)
    gettext.textdomain("pykickstart")


if six.PY3:
    import sys

    _find_locale_files()

    def _(x):
        if x == '':  # Workaround for gettext's behaviour on empty strings
            return ''

        result = gettext.lgettext(x)
        if isinstance(result, bytes):
            return result.decode(sys.getdefaultencoding())
        else:
            return result
else:
    _find_locale_files()

    _ = lambda x: gettext.lgettext(x) if x != '' else ''
Ejemplo n.º 4
0
import ethtool

PROGNAME = "system-config-network"

log = LogFile(PROGNAME)

try:
    locale.setlocale(locale.LC_ALL, "")
except locale.Error, e:
    import os
    os.environ['LC_ALL'] = 'C'
    locale.setlocale(locale.LC_ALL, "")
gettext.bind_textdomain_codeset(PROGNAME, locale.nl_langinfo(locale.CODESET))
gettext.bindtextdomain(PROGNAME, '/usr/share/locale')
gettext.textdomain(PROGNAME)
_ = lambda x: gettext.lgettext(x)
__builtin__.__dict__['_'] = _

_kernel_version = None


def kernel_version():
    global _kernel_version
    if not _kernel_version:
        (sysname, nodename, release, version,
         machine) = os.uname()  # pylint: disable-msg=W0612
        if release.find("-") != -1:
            (ver, rel) = release.split("-", 1)  # pylint: disable-msg=W0612
        else:
            ver = release
        _kernel_version = ver.split(".", 4)
Ejemplo n.º 5
0
import getopt
import shutil
from yum import _, YumBase
from yum.callbacks import DownloadBaseCallback

# everything was ok
RETURN_OK = 0
# serious problem, should be logged somewhere
RETURN_FAILURE = 2


GETTEXT_PROGNAME = "abrt"
import locale
import gettext

_ = lambda x: gettext.lgettext(x)

def init_gettext():
    try:
        locale.setlocale(locale.LC_ALL, "")
    except locale.Error:
        os.environ['LC_ALL'] = 'C'
        locale.setlocale(locale.LC_ALL, "")
    gettext.bind_textdomain_codeset(GETTEXT_PROGNAME, locale.nl_langinfo(locale.CODESET))
    gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
    gettext.textdomain(GETTEXT_PROGNAME)


verbose = 0
def log(fmt, *args):
    sys.stderr.write("%s\n" % (fmt % args))
Ejemplo n.º 6
0
#
import gettext
import os
import six

def _find_locale_files():
    module_path = os.path.abspath(__file__)
    locale_path = os.path.join(os.path.dirname(module_path), 'locale')

    gettext.bindtextdomain("pykickstart", locale_path)
    gettext.textdomain("pykickstart")

if six.PY3:
    import sys

    _find_locale_files()

    def _(x):
        if x == '':  # Workaround for gettext's behaviour on empty strings
            return ''

        result = gettext.lgettext(x)
        if isinstance(result, bytes):
            return result.decode(sys.getdefaultencoding())
        else:
            return result
else:
    _find_locale_files()

    _ = lambda x: gettext.lgettext(x) if x else ''
Ejemplo n.º 7
0
import gettext

x1 = gettext.gettext("gettext")
x2 = gettext.lgettext("lgettext")
m1 = gettext.gettext("""multi
line
string""")
Z = 'Z'
x5 = gettext.gettext(Z) # Ignored, must be string constants
Ejemplo n.º 8
0
 def update_event(self, inp=-1):
     self.set_output_val(0, gettext.lgettext(self.input(0)))
Ejemplo n.º 9
0
#
import gettext
import os
import six

def _find_locale_files():
    module_path = os.path.abspath(__file__)
    locale_path = os.path.join(os.path.dirname(module_path), 'locale')

    gettext.bindtextdomain("pykickstart", locale_path)
    gettext.textdomain("pykickstart")

if six.PY3:
    import sys

    _find_locale_files()

    def _(x):
        if x == '': # Workaround for gettext's behaviour on empty strings
            return ''

        result = gettext.lgettext(x)
        if isinstance(result, bytes):
            return result.decode(sys.getdefaultencoding())
        else:
            return result
else:
    _find_locale_files()

    _ = lambda x: gettext.lgettext(x) if x != '' else ''
Ejemplo n.º 10
0
import gettext

x1 = gettext.gettext("gettext")
x2 = gettext.lgettext("lgettext")
m1 = gettext.gettext("""multi
line
string""")
Z = 'Z'
x5 = gettext.gettext(Z)  # Ignored, must be string constants