2 # -------------------------------------------------------------------------
3 # Copyright (c) 2015-2017 AT&T Intellectual Property
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
20 """oslo.i18n integration module.
22 See http://docs.openstack.org/developer/oslo.i18n/usage.html
30 _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
32 # The primary translation function using the well-known name "_"
33 _ = _translators.primary
35 # The contextual translation function using the name "_C"
36 # requires oslo.i18n >=2.1.0
37 _C = _translators.contextual_form
39 # The plural translation function using the name "_P"
40 # requires oslo.i18n >=2.1.0
41 _P = _translators.plural_form
43 # Translators for log levels.
45 # The abbreviated names are meant to reflect the usual use of a short
46 # name like '_'. The "L" is for "log" and the other letter comes from
48 _LI = _translators.log_info
49 _LW = _translators.log_warning
50 _LE = _translators.log_error
51 _LC = _translators.log_critical
54 def translate(value, user_locale):
55 return oslo_i18n.translate(value, user_locale)
58 def get_available_languages():
59 return oslo_i18n.get_available_languages(DOMAIN)