我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用oslo_i18n.translate()。
def translate(value, user_locale): return oslo_i18n.translate(value, user_locale)
def translate(value, user_locale=None): return i18n.translate(value, user_locale)
def translate_exception(exc, locale): """Translates all translatable elements of the given exception.""" if isinstance(exc, exception.BileanException): exc.message = oslo_i18n.translate(exc.message, locale) else: exc.message = oslo_i18n.translate(six.text_type(exc), locale) if isinstance(exc, webob.exc.HTTPError): exc.explanation = oslo_i18n.translate(exc.explanation, locale) exc.detail = oslo_i18n.translate(getattr(exc, 'detail', ''), locale) return exc
def translate(value, user_locale): """Translate""" return oslo_i18n.translate(value, user_locale)