Mercurial > babel > old > mirror
comparison babel/support.py @ 404:7a3ab3e0dcb0
Fix `babel.support.Translations.__repr__` and make it less stupid; Include the project name and version defined on the catalog loaded.
author | palgarvio |
---|---|
date | Tue, 05 Aug 2008 23:30:50 +0000 |
parents | 3a0cea7b8050 |
children | dc5b9feeab62 |
comparison
equal
deleted
inserted
replaced
403:3a0cea7b8050 | 404:7a3ab3e0dcb0 |
---|---|
279 return self.value[key] | 279 return self.value[key] |
280 | 280 |
281 def __setitem__(self, key, value): | 281 def __setitem__(self, key, value): |
282 self.value[key] = value | 282 self.value[key] = value |
283 | 283 |
284 | 284 |
285 class Translations(gettext.GNUTranslations): | 285 class Translations(gettext.GNUTranslations, object): |
286 """An extended translation catalog class.""" | 286 """An extended translation catalog class.""" |
287 | 287 |
288 DEFAULT_DOMAIN = 'messages' | 288 DEFAULT_DOMAIN = 'messages' |
289 | 289 |
290 def __init__(self, fileobj=None): | 290 def __init__(self, fileobj=None): |
319 load = classmethod(load) | 319 load = classmethod(load) |
320 | 320 |
321 def merge(self, translations): | 321 def merge(self, translations): |
322 """Merge the given translations into the catalog. | 322 """Merge the given translations into the catalog. |
323 | 323 |
324 Message translations in the specfied catalog override any messages with | 324 Message translations in the specified catalog override any messages with |
325 the same identifier in the existing catalog. | 325 the same identifier in the existing catalog. |
326 | 326 |
327 :param translations: the `Translations` instance with the messages to | 327 :param translations: the `Translations` instance with the messages to |
328 merge | 328 merge |
329 :return: the `Translations` instance (``self``) so that `merge` calls | 329 :return: the `Translations` instance (``self``) so that `merge` calls |
334 self._catalog.update(translations._catalog) | 334 self._catalog.update(translations._catalog) |
335 self.files.extend(translations.files) | 335 self.files.extend(translations.files) |
336 return self | 336 return self |
337 | 337 |
338 def __repr__(self): | 338 def __repr__(self): |
339 return "<%s>" % (type(self).__name__) | 339 return '<%s: "%s">' % (type(self).__name__, |
340 self._info.get('project-id-version')) |