annotate MoinMoin/i18n/tools/wiki2po.py @ 4039:532865ba8334

update i18n scripts to access master18 wiki
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 30 Aug 2008 21:13:44 +0200
parents 30a254da9eba
children aa929a72715d
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 """
4039
532865ba8334 update i18n scripts to access master18 wiki
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3437
diff changeset
5
532865ba8334 update i18n scripts to access master18 wiki
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3437
diff changeset
6 master_url = "http://master18.moinmo.in/?action=xmlrpc2"
532865ba8334 update i18n scripts to access master18 wiki
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3437
diff changeset
7
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
8 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
9
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
10 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
11 import sys, xmlrpclib
1662
3338af3c3867 update i18n, fix i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1291
diff changeset
12 sys.path.insert(0, '../..')
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
13
1291
277695e8e6f5 updated i18n, cosmetic changes to i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 991
diff changeset
14 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
15
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
16 lang = sys.argv[1]
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 if not lang in excluded:
4039
532865ba8334 update i18n scripts to access master18 wiki
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3437
diff changeset
19 wiki = xmlrpclib.ServerProxy(master_url)
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
20
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 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
22 print pagename
1291
277695e8e6f5 updated i18n, cosmetic changes to i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 991
diff changeset
23 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
24
3051
b1e7d968330d i18n tools: fix small bugs (ported from 1.6)
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 2924
diff changeset
25 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
26 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
27 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
28
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
29 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
30 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
31