annotate MoinMoin/i18n/tools/wiki2po.py @ 686:f2debe9be4e0

more i18n cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 22 May 2006 00:44:12 +0200
parents MoinMoin/i18n/wiki2po.py@16519af337fe
children 9dcd18a790ab
rev   line source
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
1 #!/usr/bin/python
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
2 """
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
3 get latest translation page content from the wiki and write it to *.po
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
4 """
491
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
5 def run():
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
6 import sys, xmlrpclib
686
f2debe9be4e0 more i18n cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 597
diff changeset
7 sys.path.insert(0, '../../..')
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
8
597
16519af337fe remove some references to tla
tw@waldmann-edv.de
parents: 491
diff changeset
9 excluded = ["en",] # languages managed in repository, not in wiki
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
10
491
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
11 langfname = sys.argv[1]
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
12 lang = langfname.replace('_', '-') # module names use _ instead of -
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
13
491
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
14 if not lang in excluded:
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
15 wiki = xmlrpclib.ServerProxy("http://moinmaster.wikiwikiweb.de/?action=xmlrpc2")
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
16
491
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
17 pagename = "MoinI18n/%s" % lang
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
18 pagedata = wiki.getPage(pagename).encode('utf-8').replace("\n","\r\n")
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
19
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
20 f = open("%s.po" % langfname, "w")
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
21 f.write(pagedata)
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
22 f.close()
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
23
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
24 if __name__ == "__main__":
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
25 run()
be33ecd58d4e add run() methods to scripts, include version info into MoinMoin/__init__.py for epydoc
Thomas Waldmann <tw@waldmann-edv.de>
parents: 202
diff changeset
26