|
| 1 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | +# not use this file except in compliance with the License. You may obtain |
| 3 | +# a copy of the License at |
| 4 | +# |
| 5 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +# |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +# License for the specific language governing permissions and limitations |
| 11 | +# under the License. |
| 12 | + |
| 13 | +"""oslo.i18n integration module. |
| 14 | +
|
| 15 | +See http://docs.openstack.org/developer/oslo.i18n/usage.html |
| 16 | +
|
| 17 | +""" |
| 18 | + |
| 19 | +try: |
| 20 | + import oslo.i18n |
| 21 | + |
| 22 | + # NOTE(dhellmann): This reference to o-s-l-o will be replaced by the |
| 23 | + # application name when this module is synced into the separate |
| 24 | + # repository. It is OK to have more than one translation function |
| 25 | + # using the same domain, since there will still only be one message |
| 26 | + # catalog. |
| 27 | + _translators = oslo.i18n.TranslatorFactory(domain='ironic_python_agent') |
| 28 | + |
| 29 | + # The primary translation function using the well-known name "_" |
| 30 | + _ = _translators.primary |
| 31 | + |
| 32 | + # Translators for log levels. |
| 33 | + # |
| 34 | + # The abbreviated names are meant to reflect the usual use of a short |
| 35 | + # name like '_'. The "L" is for "log" and the other letter comes from |
| 36 | + # the level. |
| 37 | + _LI = _translators.log_info |
| 38 | + _LW = _translators.log_warning |
| 39 | + _LE = _translators.log_error |
| 40 | + _LC = _translators.log_critical |
| 41 | +except ImportError: |
| 42 | + # NOTE(dims): Support for cases where a project wants to use |
| 43 | + # code from ironic_python_agent-incubator, but is not ready to be internationalized |
| 44 | + # (like tempest) |
| 45 | + _ = _LI = _LW = _LE = _LC = lambda x: x |
0 commit comments