##// END OF EJS Templates
i18n: posplit writes a warning for translators before rst directives...
Simon Heimberg -
r20359:ff6ab0b2 default
parent child Browse files
Show More
@@ -5,6 +5,7 b''
5 # license: MIT/X11/Expat
5 # license: MIT/X11/Expat
6 #
6 #
7
7
8 import re
8 import sys
9 import sys
9 import polib
10 import polib
10
11
@@ -30,6 +31,7 b' if __name__ == "__main__":'
30 cache = {}
31 cache = {}
31 entries = po[:]
32 entries = po[:]
32 po[:] = []
33 po[:] = []
34 findd = re.compile(r' *\.\. (\w+)::') # for finding directives
33 for entry in entries:
35 for entry in entries:
34 msgids = entry.msgid.split(u'\n\n')
36 msgids = entry.msgid.split(u'\n\n')
35 if entry.msgstr:
37 if entry.msgstr:
@@ -51,6 +53,14 b' if __name__ == "__main__":'
51 for msgid, msgstr in zip(msgids, msgstrs):
53 for msgid, msgstr in zip(msgids, msgstrs):
52 if msgid:
54 if msgid:
53 newentry = mkentry(entry, delta, msgid, msgstr)
55 newentry = mkentry(entry, delta, msgid, msgstr)
56 mdirective = findd.match(msgid)
57 if mdirective:
58 directive = mdirective.group(1)
59 comment = 'do not translate: .. %s::' % directive
60 if not newentry.comment:
61 newentry.comment = comment
62 elif comment not in newentry.comment:
63 newentry.comment += '\n' + comment
54 addentry(po, newentry, cache)
64 addentry(po, newentry, cache)
55 delta += 2 + msgid.count('\n')
65 delta += 2 + msgid.count('\n')
56 po.save()
66 po.save()
General Comments 0
You need to be logged in to leave comments. Login now