Back to index

moin  1.9.0~rc2
wiki2po.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 """
00003     get latest translation page content from the wiki and write it to *.po
00004 """
00005 
00006 master_url = "http://master19.moinmo.in/?action=xmlrpc2"
00007 
00008 DOMAIN = "MoinMoin"
00009 
00010 def run():
00011     import sys, xmlrpclib
00012     sys.path.insert(0, '../..')
00013 
00014     excluded = ["en", ] # languages managed in repository, not in wiki
00015 
00016     lang = sys.argv[1]
00017 
00018     if not lang in excluded:
00019         wiki = xmlrpclib.ServerProxy(master_url)
00020 
00021         pagename = "MoinI18n/%s" % lang
00022         print pagename
00023         pagedata = wiki.getPage(pagename).encode('utf-8').replace("\n", "\r\n")
00024 
00025         f = open("%s.%s.po" % (lang, DOMAIN), "w")
00026         f.write(pagedata)
00027         f.close()
00028 
00029 if __name__ == "__main__":
00030     run()
00031