view MoinMoin/i18n/ @ 491:be33ecd58d4e

add run() methods to scripts, include version info into MoinMoin/ for epydoc imported from: moin--main--1.5--patch-495
author Thomas Waldmann <>
date Wed, 22 Mar 2006 09:55:32 +0000
parents 06b518ccacd7
children 16519af337fe
line wrap: on
line source
    remove everthing top of the first msgid line (PIs destroyed by gettext),
    prepend some processing instructions to a .po file to be able to put it
    onto moinmaster wiki, letting it get processed by gettext parser
def run():
    import sys, os, xmlrpclib
    sys.path.insert(0, '../..')

    excluded = ["en",] # languages managed in tla repository, not in wiki

    lang = sys.argv[1]
    lang = lang.replace('_', '-') # module names use _ instead of -

    data =

    if lang in excluded:
        f = open("%s.po" % lang, "w")
    data = data.decode('utf-8')

    cutpos = data.index(u"msgid")
    data = data[cutpos:] # remove comments at top

    data = u"""\
## Please edit system and help pages ONLY in the moinmaster wiki! For more
## information, please see MoinMaster:MoinPagesEditorGroup.
#acl MoinPagesEditorGroup:read,write,delete,revert All:read
#format gettext
#language %s

# MoinMoin %s system text translation
%s""" % (lang, lang, data)

    from import BasicAuthTransport

    user = "ThomasWaldmann" # must be a known Wiki account
    password = os.environ.get("PASS", "")
    pagename = "MoinI18n/%s" % lang
    pagedata = data.encode('utf-8')

    authtrans = BasicAuthTransport(user, password)
    wiki = xmlrpclib.ServerProxy("", transport=authtrans)

    rc = wiki.putPage(pagename, pagedata)
    print "Page: %s rc=%s" % (pagename, rc)

if __name__ == "__main__":