view MoinMoin/macro/ @ 1320:a36c70e5f0dd

Reworked i18n and logging support, from now on, the log is attached to the job page.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Thu, 17 Aug 2006 21:05:23 +0200
children b7352ce35900
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - Load I18N Text and substitute data.

    This macro has the main purpose of being used by extensions that write
    data to wiki pages but want to ensure that it is properly translated.

    @copyright: 2006 by MoinMoin:AlexanderSchremmer
    @license: GNU GPL, see COPYING for details.

from MoinMoin import wikiutil
from MoinMoin.packages import unpackLine

Dependencies = ["language"]

def execute(macro, args):
    """ args consists of a character specifiying the separator and then a
    packLine sequence describing a list. The first element of it is the message
    and the remaining elements are substituted in the message using string
    sep = args[0]
    args = unpackLine(args[1:], sep)
    translation = macro.request.getText(args[0], formatted=False)
    message = translation % tuple(args[1:])

    return macro.formatter.text(message)