Mercurial > babel > old > mirror
diff babel/messages/catalog.py @ 231:fc8b8c2bba53
Remove duplicate locations of catalog messages.
author | cmlenz |
---|---|
date | Tue, 24 Jul 2007 21:16:57 +0000 |
parents | aaf36f409166 |
children | 194f927d8c5a |
line wrap: on
line diff
--- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -33,7 +33,8 @@ __all__ = ['Message', 'Catalog', 'TranslationError'] __docformat__ = 'restructuredtext en' -PYTHON_FORMAT = re.compile(r'\%(\([\w]+\))?([-#0\ +])?(\*|[\d]+)?(\.(\*|[\d]+))?([hlL])?[diouxXeEfFgGcrs]') +PYTHON_FORMAT = re.compile(r'\%(\([\w]+\))?([-#0\ +])?(\*|[\d]+)?' + r'(\.(\*|[\d]+))?([hlL])?[diouxXeEfFgGcrs]') class Message(object): @@ -60,7 +61,7 @@ if not string and self.pluralizable: string = (u'', u'') self.string = string #: The message translation - self.locations = list(locations) + self.locations = list(distinct(locations)) self.flags = set(flags) if id and self.python_format: self.flags.add('python-format') @@ -470,7 +471,8 @@ # The new message adds pluralization current.id = message.id current.string = message.string - current.locations.extend(message.locations) + current.locations = list(distinct(current.locations + + message.locations)) current.auto_comments = list(distinct(current.auto_comments + message.auto_comments)) current.user_comments = list(distinct(current.user_comments +