def gettext(string, **variables):
    """Translates a string with the current locale and passes in the
    given keyword arguments as mapping to a string formatting string.

    ::

        gettext(u'Hello World!')
        gettext(u'Hello %(name)s!', name='World')
    """
    t = get_translations()
    if variables:
        if t is None:
            return string % variables
        return t.ugettext(string) % variables
    if t is None:
        return string
    return t.ugettext(string)
dataset/ETHPy150Open gengo/decanter/decanter/lib/i18n.py/gettext/original