Back to index

moin  1.9.0~rc2
prepend.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 """
00003     prepend some processing instructions to a .po file to be able to put it
00004     onto moinmaster wiki, letting it get processed by gettext parser
00005 
00006     for f in *.po; do ./prepend.py $f; done
00007 """
00008 def run():
00009     import sys, codecs
00010     fname = sys.argv[1]
00011 
00012     lang = fname.replace('.po_', '').replace('.po', '')
00013 
00014     f = codecs.open(fname, 'r', 'utf-8')
00015     data = f.read()
00016     f.close()
00017 
00018     data = u"""\
00019 ## Please edit system and help pages ONLY in the moinmaster wiki! For more
00020 ## information, please see MoinMaster:MoinPagesEditorGroup.
00021 ##master-page:None
00022 ##master-date:None
00023 #acl MoinPagesEditorGroup:read,write,delete,revert All:read
00024 #format gettext
00025 #language %s
00026 
00027 %s""" % (lang, data)
00028 
00029     f = codecs.open(fname, 'w', 'utf-8')
00030     f.write(data)
00031     f.close()
00032 
00033 if __name__ == "__main__":
00034     run()
00035