Ejemplo n.º 1
0
Archivo: log.py Proyecto: KDE/kajongg
def m18nc(context, englishText, *args):
    """
    Wrapper around i18n. i18n only accepts and returns
    native strings.

    @param context: The context for this string.
    @type context: C{str}
    @param englishText : The text template.
    @type englishText: C{str} (utf-8) or C{unicode}.

    @param args : Arguments for the text template.
    @type args: A list or tuple of strings.

    @return: The translated text with args inserted.
    @rtype: C{unicode}.
    """
    result = unicodeString(
        i18nc(
            context,
            nativeString(englishText),
            *unicodeStringArgs(args)))
    if not args:
        ENGLISHDICT[result] = unicodeString(englishText)
    return result
Ejemplo n.º 2
0
Archivo: log.py Proyecto: KDE/kajongg
def m18n(englishText, *args):
    """
    Wrapper around i18n.

    @param englishText : The text template.
    @type englishText: C{str} (utf-8)  or C{unicode}.

    @param args : Arguments for the text template.
    @type args: A list or tuple of strings.

    @return: The translated text with args inserted.
    @rtype: C{unicode}.

    Since when do args have to be unicode? utf-8
    encoded fails.
    """
    result = unicodeString(
        i18n(
            nativeString(
                englishText),
            *unicodeStringArgs(args)))
    if not args:
        ENGLISHDICT[result] = unicodeString(englishText)
    return result