Changeset 391 for python/trunk/Tools/i18n
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Tools/i18n/makelocalealias.py
r2 r391 10 10 11 11 # Location of the alias file 12 LOCALE_ALIAS = '/usr/ lib/X11/locale/locale.alias'12 LOCALE_ALIAS = '/usr/share/X11/locale/locale.alias' 13 13 14 14 def parse(filename): -
python/trunk/Tools/i18n/msgfmt.py
r2 r391 26 26 """ 27 27 28 import os 28 29 import sys 29 import os30 import ast 30 31 import getopt 31 32 import struct … … 138 139 continue 139 140 # Now we are in a msgid section, output previous section 140 if l.startswith('msgid') :141 if l.startswith('msgid') and not l.startswith('msgid_plural'): 141 142 if section == STR: 142 143 add(msgid, msgstr, fuzzy) … … 144 145 l = l[5:] 145 146 msgid = msgstr = '' 147 is_plural = False 148 # This is a message with plural forms 149 elif l.startswith('msgid_plural'): 150 if section != ID: 151 print >> sys.stderr, 'msgid_plural not preceded by msgid on %s:%d' %\ 152 (infile, lno) 153 sys.exit(1) 154 l = l[12:] 155 msgid += '\0' # separator of singular and plural 156 is_plural = True 146 157 # Now we are in a msgstr section 147 158 elif l.startswith('msgstr'): 148 159 section = STR 149 l = l[6:] 160 if l.startswith('msgstr['): 161 if not is_plural: 162 print >> sys.stderr, 'plural without msgid_plural on %s:%d' %\ 163 (infile, lno) 164 sys.exit(1) 165 l = l.split(']', 1)[1] 166 if msgstr: 167 msgstr += '\0' # Separator of the various plural forms 168 else: 169 if is_plural: 170 print >> sys.stderr, 'indexed msgstr required for plural on %s:%d' %\ 171 (infile, lno) 172 sys.exit(1) 173 l = l[6:] 150 174 # Skip empty lines 151 175 l = l.strip() 152 176 if not l: 153 177 continue 154 # XXX: Does this always follow Python escape semantics? 155 l = eval(l) 178 l = ast.literal_eval(l) 156 179 if section == ID: 157 180 msgid += l -
python/trunk/Tools/i18n/pygettext.py
r2 r391 212 212 def make_escapes(pass_iso8859): 213 213 global escapes 214 escapes = [chr(i) for i in range(256)] 214 215 if pass_iso8859: 215 216 # Allow iso-8859 characters to pass through so that e.g. 'msgid … … 219 220 else: 220 221 mod = 256 221 for i in range(256): 222 if 32 <= (i % mod) <= 126: 223 escapes.append(chr(i)) 224 else: 225 escapes.append("\\%03o" % i) 222 for i in range(mod): 223 if not(32 <= i <= 126): 224 escapes[i] = "\\%03o" % i 226 225 escapes[ord('\\')] = '\\\\' 227 226 escapes[ord('\t')] = '\\t' … … 600 599 601 600 # calculate escapes 602 make_escapes( options.escape)601 make_escapes(not options.escape) 603 602 604 603 # calculate all keywords
Note:
See TracChangeset
for help on using the changeset viewer.