annotate MoinMoin/i18n/tools/wiki2po.py @ 1291:277695e8e6f5

updated i18n, cosmetic changes to i18n tools
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 15 Aug 2006 22:59:12 +0200
parents 324a20dad828
children 3338af3c3867
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
686
f2debe9be4e0 more i18n cleanup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 597
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
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
13 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
14 lang = langfname.replace('_', '-') # module names use _ instead of -
162
e8da71f39a92 added wiki2po script, updated i18n
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
15
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
16 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
17 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
18
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
19 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
20 print pagename
1291
277695e8e6f5 updated i18n, cosmetic changes to i18n tools
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 991
diff changeset
21 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
22
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
23 f = open("%s.%s.po" % (langfname, 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
24 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
25 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
26
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 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
28 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
29