All pastes #508394 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-25 00:08 UTC
rendered paste body
Python's syntax is a little verbose, but putting in the names of all the arguments gives more context to the translator.
However if you really want a simpler numbered syntax instead, copy this function into your source:

def gettext_ordered(string, *args):
    d = {}
    for i, arg in enumerate(args):
        d[str(i+1)] = arg
    return string % d

>>> gettext_ordered("%(1)s by %(2)s", "The white album", "the beatles")
'The white album by the beatles'