comparison babel/support.py @ 407:b12eeaad51c5 stable-0.9.x

Ported [442:446/trunk] to 0.9.x branch.
author cmlenz
date Mon, 25 Aug 2008 10:08:22 +0000
parents c2ae38340540
children d1a27b087ea4
comparison
equal deleted inserted replaced
400:bd03ca5059f3 407:b12eeaad51c5
266 return self.value[key] 266 return self.value[key]
267 267
268 def __setitem__(self, key, value): 268 def __setitem__(self, key, value):
269 self.value[key] = value 269 self.value[key] = value
270 270
271 271
272 class Translations(gettext.GNUTranslations): 272 class Translations(gettext.GNUTranslations, object):
273 """An extended translation catalog class.""" 273 """An extended translation catalog class."""
274 274
275 DEFAULT_DOMAIN = 'messages' 275 DEFAULT_DOMAIN = 'messages'
276 276
277 def __init__(self, fileobj=None): 277 def __init__(self, fileobj=None):
306 load = classmethod(load) 306 load = classmethod(load)
307 307
308 def merge(self, translations): 308 def merge(self, translations):
309 """Merge the given translations into the catalog. 309 """Merge the given translations into the catalog.
310 310
311 Message translations in the specfied catalog override any messages with 311 Message translations in the specified catalog override any messages with
312 the same identifier in the existing catalog. 312 the same identifier in the existing catalog.
313 313
314 :param translations: the `Translations` instance with the messages to 314 :param translations: the `Translations` instance with the messages to
315 merge 315 merge
316 :return: the `Translations` instance (``self``) so that `merge` calls 316 :return: the `Translations` instance (``self``) so that `merge` calls
321 self._catalog.update(translations._catalog) 321 self._catalog.update(translations._catalog)
322 self.files.extend(translations.files) 322 self.files.extend(translations.files)
323 return self 323 return self
324 324
325 def __repr__(self): 325 def __repr__(self):
326 return "<%s>" % (type(self).__name__) 326 return '<%s: "%s">' % (type(self).__name__,
327 self._info.get('project-id-version'))
Copyright (C) 2012-2017 Edgewall Software