annotate MoinMoin/i18n/tools/wiki2po.py @ 3051:b1e7d968330d

i18n tools: fix small bugs (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 19 Feb 2008 23:30:04 +0100
parents b551fc405222
children cd6cfc715261
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 """
896
9dcd18a790ab i18n: no .mo files anymore, we directly read .po and cache the result
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 686
diff changeset
5 DOMAIN = "MoinMoin"
9dcd18a790ab i18n: no .mo files anymore, we directly read .po and cache the result
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 686
diff changeset
6
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
7 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
8 import sys, xmlrpclib
1662
3338af3c3867 update i18n, fix i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1291
diff changeset
9 sys.path.insert(0, '../..')
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
10
1291
277695e8e6f5 updated i18n, cosmetic changes to i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 991
diff changeset
11 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
12
2924
b551fc405222 use standard xx-yy for languages now (not xx_yy), fixes zh-tw issue (port from 1.6)
Johannes Berg <johannes AT sipsolutions DOT net>
parents: 1662
diff changeset
13 lang = sys.argv[1]
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
14
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
15 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
16 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
17
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
18 pagename = "MoinI18n/%s" % lang
896
9dcd18a790ab i18n: no .mo files anymore, we directly read .po and cache the result
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 686
diff changeset
19 print pagename
1291
277695e8e6f5 updated i18n, cosmetic changes to i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 991
diff changeset
20 pagedata = wiki.getPage(pagename).encode('utf-8').replace("\n", "\r\n")
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
21
3051
b1e7d968330d i18n tools: fix small bugs (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2924
diff changeset
22 f = open("%s.%s.po" % (lang, DOMAIN), "w")
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
23 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
24 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
25
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 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
27 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
28