Skip to content

Add more format support like *args #220

@betterlch

Description

@betterlch

like this:

def gettext(string, *args, **variables):
    """
        gettext(u'Hello World!')
        gettext(u'Hello %(name)s!', name='World')
        gettext(u'Hello %s!', 'World')
    """
    t = get_translations()
    if t is None:
        return string if not variables else string % variables
    s = t.ugettext(string)
    if args:
        return s % args
    else:
        return s if not variables else s % variables

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions