Mercurial > babel > old > mirror
comparison babel/messages/catalog.py @ 228:629357c88d59
Only write unique comments, no duplicates.
author | palgarvio |
---|---|
date | Fri, 20 Jul 2007 14:22:50 +0000 |
parents | f358dd40a960 |
children | 85340bec3a97 |
comparison
equal
deleted
inserted
replaced
227:f358dd40a960 | 228:629357c88d59 |
---|---|
64 self.flags = set(flags) | 64 self.flags = set(flags) |
65 if id and self.python_format: | 65 if id and self.python_format: |
66 self.flags.add('python-format') | 66 self.flags.add('python-format') |
67 else: | 67 else: |
68 self.flags.discard('python-format') | 68 self.flags.discard('python-format') |
69 self.auto_comments = list(auto_comments) | 69 self.auto_comments = list(set(auto_comments)) |
70 self.user_comments = list(user_comments) | 70 self.user_comments = list(set(user_comments)) |
71 if isinstance(previous_id, basestring): | 71 if isinstance(previous_id, basestring): |
72 self.previous_id = [previous_id] | 72 self.previous_id = [previous_id] |
73 else: | 73 else: |
74 self.previous_id = list(previous_id) | 74 self.previous_id = list(previous_id) |
75 self.lineno = lineno | 75 self.lineno = lineno |
515 self[id] = Message(id, string, list(locations), flags, auto_comments, | 515 self[id] = Message(id, string, list(locations), flags, auto_comments, |
516 user_comments, previous_id, lineno=lineno) | 516 user_comments, previous_id, lineno=lineno) |
517 | 517 |
518 def check(self): | 518 def check(self): |
519 """Run various validation checks on the translations in the catalog. | 519 """Run various validation checks on the translations in the catalog. |
520 | 520 |
521 For every message which fails validation, this method yield a | 521 For every message which fails validation, this method yield a |
522 ``(message, errors)`` tuple, where ``message`` is the `Message` object | 522 ``(message, errors)`` tuple, where ``message`` is the `Message` object |
523 and ``errors`` is a sequence of `TranslationError` objects. | 523 and ``errors`` is a sequence of `TranslationError` objects. |
524 | 524 |
525 :rtype: ``iterator`` | 525 :rtype: ``iterator`` |
526 """ | 526 """ |
527 checkers = [] | 527 checkers = [] |
528 from pkg_resources import working_set | 528 from pkg_resources import working_set |
529 for entry_point in working_set.iter_entry_points('babel.checkers'): | 529 for entry_point in working_set.iter_entry_points('babel.checkers'): |