Changeset 388 for python/vendor/current/Lib/gettext.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/gettext.py
r2 r388 317 317 # Unicode using the character encoding specified in the charset 318 318 # parameter of the Content-Type header. The gettext documentation 319 # strongly encourages msgids to be us-ascii, but some appli ations319 # strongly encourages msgids to be us-ascii, but some applications 320 320 # require alternative encodings (e.g. Zope's ZCML and ZPT). For 321 321 # traditional gettext applications, the msgid conversion will … … 468 468 return NullTranslations() 469 469 raise IOError(ENOENT, 'No translation file found for domain', domain) 470 # TBD: do we need to worry about the file pointer getting collected?471 470 # Avoid opening, reading, and parsing the .mo file after it's been done 472 471 # once. 473 472 result = None 474 473 for mofile in mofiles: 475 key = os.path.abspath(mofile)474 key = (class_, os.path.abspath(mofile)) 476 475 t = _translations.get(key) 477 476 if t is None: 478 t = _translations.setdefault(key, class_(open(mofile, 'rb'))) 477 with open(mofile, 'rb') as fp: 478 t = _translations.setdefault(key, class_(fp)) 479 479 # Copy the translation object to allow setting fallbacks and 480 480 # output charset. All other instance data is shared with the
Note:
See TracChangeset
for help on using the changeset viewer.