Commit f49d7b7c authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

a bit modify previous commit ba435293, use untouched message for default,...

a bit modify previous commit ba435293, use untouched message for default, and explicitly convert to unicode for non existing case.
parent ba435293
...@@ -266,13 +266,14 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem): ...@@ -266,13 +266,14 @@ class MessageCatalog(LanguageManager, ObjectManager, SimpleItem):
raise TypeError, 'only strings can be translated.' raise TypeError, 'only strings can be translated.'
message = message.strip() message = message.strip()
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
message = self.get_message_key(message) or message
if default is None: if default is None:
default = message default = message
# BBB call get_message_key to support both (old) str key and
# (new) unicode key.
message = self.get_message_key(message) or to_unicode(message)
# Add it if it's not in the dictionary # Add it if it's not in the dictionary
if add and not self._messages.has_key(message) and message: if add and not self._messages.has_key(message) and message:
self._messages[message] = PersistentMapping() self._messages[message] = PersistentMapping()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment