Changeset 391 for python/trunk/Lib/gettext.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 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/Lib/gettext.py
r60 r391 324 324 # Unicode using the character encoding specified in the charset 325 325 # parameter of the Content-Type header. The gettext documentation 326 # strongly encourages msgids to be us-ascii, but some appli ations326 # strongly encourages msgids to be us-ascii, but some applications 327 327 # require alternative encodings (e.g. Zope's ZCML and ZPT). For 328 328 # traditional gettext applications, the msgid conversion will … … 475 475 return NullTranslations() 476 476 raise IOError(ENOENT, 'No translation file found for domain', domain) 477 # TBD: do we need to worry about the file pointer getting collected?478 477 # Avoid opening, reading, and parsing the .mo file after it's been done 479 478 # once. 480 479 result = None 481 480 for mofile in mofiles: 482 key = os.path.abspath(mofile)481 key = (class_, os.path.abspath(mofile)) 483 482 t = _translations.get(key) 484 483 if t is None: 485 t = _translations.setdefault(key, class_(open(mofile, 'rb'))) 484 with open(mofile, 'rb') as fp: 485 t = _translations.setdefault(key, class_(fp)) 486 486 # Copy the translation object to allow setting fallbacks and 487 487 # output charset. All other instance data is shared with the
Note:
See TracChangeset
for help on using the changeset viewer.