diff options
author | matthew <matthew@38b22f21-9aea-0310-abfc-843a9883df58> | 2006-04-12 23:25:50 (GMT) |
---|---|---|
committer | matthew <matthew@38b22f21-9aea-0310-abfc-843a9883df58> | 2006-04-12 23:25:50 (GMT) |
commit | 9766ffc572aadda393ced67598fabe704fab7db6 (patch) | |
tree | 278c2fc58cfeb5602e45fabcd95ad5dec8f4dcf9 /tools | |
parent | de92a3e315ec4faa6ff0c9eb90c721a532d5d84f (diff) |
Merged in changes from 0.15 branch
git-svn-id: https://exe.svn.sourceforge.net/svnroot/exe/trunk@2094 38b22f21-9aea-0310-abfc-843a9883df58
Diffstat (limited to 'tools')
-rw-r--r-- | tools/mki18n.py | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/tools/mki18n.py b/tools/mki18n.py index 603a513..d9542a5 100644 --- a/tools/mki18n.py +++ b/tools/mki18n.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- # # PYTHON MODULE: MKI18N.PY # ========= @@ -210,7 +210,7 @@ iso639_languageDict = { 'aa' : 'Afar. ', 'mt' : 'Maltese. ', 'my' : 'Burmese. ', 'na' : 'Nauru. ', - 'nb' : 'Norwegian Bokmål. ', + 'nb' : 'Norwegian BokmÃ¥l. ', 'nd' : 'Ndebele, North. ', 'ne' : 'Nepali. ', 'ng' : 'Ndonga. ', @@ -220,7 +220,7 @@ iso639_languageDict = { 'aa' : 'Afar. ', 'nr' : 'Ndebele, South. ', 'nv' : 'Navajo. ', 'ny' : 'Chichewa; Nyanja. ', - 'oc' : 'Occitan; Provençal. ', + 'oc' : 'Occitan; Provençal. ', 'om' : '(Afan) Oromo. ', 'or' : 'Oriya. ', 'os' : 'Ossetian; Ossetic. ', @@ -272,7 +272,7 @@ iso639_languageDict = { 'aa' : 'Afar. ', 'ur' : 'Urdu. ', 'uz' : 'Uzbek. ', 'vi' : 'Vietnamese. ', - 'vo' : 'Volapük; Volapuk. ', + 'vo' : 'Volapük; Volapuk. ', 'wa' : 'Walloon. ', 'wo' : 'Wolof. ', 'xh' : 'Xhosa. ', @@ -501,27 +501,24 @@ def dict2pot(dct, filename, verbose=False): msgid, (seq, comments, msgstr) in dct.items()] for seq, comments, msgid, msgstr in sorted(data): - if isinstance(msgid, unicode): - # Cut off the u in front of the string - start = 2 - else: - start = 1 # comments write('\n') for line in comments: write('%s\n' % line.encode('utf8')) # Msgid - if '\n' in msgid: + msgid = msgid.encode('utf8').replace('"', r'\"') + if '\n' in msgid or len(msgid) > 80: write('msgid ""\n') write(multiLineOutput(msgid)) else: - write('msgid "%s"\n' % `msgid`[start:-1].replace('"', '\\"')) + write('msgid "%s"\n' % msgid) # Msgstr - if '\n' in msgstr: + msgstr = msgstr.encode('utf8').replace('"', r'\"') + if '\n' in msgstr or len(msgstr) > 80: write('msgstr ""\n') write(multiLineOutput(msgstr)) else: - write('msgstr "%s"\n' % `msgstr`[start:-1].replace('"', '\\"')) + write('msgstr "%s"\n' % msgstr) def multiLineOutput(string): @@ -531,15 +528,11 @@ def multiLineOutput(string): result = '' lines = string.split('\n') for line in lines[:-1]: - result += '"%s\\n"\n' % `line`[1:-1].replace('"', '\\"') + result += '"%s\\n"\n' % line if lines[-1]: - result += '"%s"\n' % `lines[-1]`[1:-1].replace('"', '\\"') + result += '"%s"\n' % lines[-1] return result - - - - # ----------------------------------------------------------------------------- # c a t P O ( ) -- Concatenate one or several PO files with the application domain files. -- |