def resolve_i18n_message(message, messages, locale, default_locale=None):
 if ((not message) or (not isinstance(message, basestring))):
  return message
 match = MSG_RE.match(message)
 if (match is None):
  return message
 locale = find_language(locale)
 if default_locale:
  default_locale = find_language(default_locale)
 msgid = match.group('msgid')
 default = {'message': message}
 if (locale in messages):
  message = messages[locale].get(msgid, default)
 elif (default_locale in messages):
  message = messages[default_locale].get(msgid, default)
 if (not isinstance(message, dict)):
  return default['message']
 return message['message']

def resolve_i18n_message ( message , messages , locale , default_locale = None ) : if ( ( not message ) or ( not isinstance ( message , basestring ) ) ) : return message match = MSG_RE . match ( message ) if ( match is None ) : return message locale = find_language ( locale ) if default_locale : default_locale = find_language ( default_locale ) msgid = match . group ( 'msgid' ) default = { 'message' : message } if ( locale in messages ) : message = messages [ locale ] . get ( msgid , default ) elif ( default_locale in messages ) : message = messages [ default_locale ] . get ( msgid , default ) if ( not isinstance ( message , dict ) ) : return default [ 'message' ] return message [ 'message' ]
resolve a translatable string in an add-on .