~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/i18n/prepend.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
"""
3
 
    prepend some processing instructions to a .po file to be able to put it
4
 
    onto moinmaster wiki, letting it get processed by gettext parser
5
 
 
6
 
    for f in *.po; do ./prepend.py $f; done
7
 
"""
8
 
def run():
9
 
    import sys, codecs
10
 
    fname = sys.argv[1]
11
 
 
12
 
    lang = fname.replace('.po_', '').replace('.po', '')
13
 
    lang = lang.replace('_', '-') # module names use _ instead of -
14
 
 
15
 
    f = codecs.open(fname, 'r', 'utf-8')
16
 
    data = f.read()
17
 
    f.close()
18
 
 
19
 
    data = u"""\
20
 
## Please edit system and help pages ONLY in the moinmaster wiki! For more
21
 
## information, please see MoinMaster:MoinPagesEditorGroup.
22
 
##master-page:None
23
 
##master-date:None
24
 
#acl MoinPagesEditorGroup:read,write,delete,revert All:read
25
 
#format gettext
26
 
#language %s
27
 
 
28
 
%s""" % (lang, data)
29
 
 
30
 
    f = codecs.open(fname, 'w', 'utf-8')
31
 
    f.write(data)
32
 
    f.close()
33
 
 
34
 
if __name__ == "__main__":
35
 
    run()
36