summaryrefslogtreecommitdiffstats
path: root/openstack/common/gettextutils.py
Commit message (Collapse)AuthorAgeFilesLines
* Enable hacking H404 test.Dina Belova2013-06-111-5/+5
| | | | | | H404 - multi line docstring should start with a summary. Change-Id: I2099e1ee81ff9657f7a07401b8e8f3327d03bdbd
* Add basic lazy gettext implementationMatt Odden2013-05-231-0/+176
| | | | | | | | | | | | | This is the first part of an implementation towards a deferred localization functionality in OpenStack. This change adds a Message class for encapsulating a translatable message and its relevant data, as well as an example LogHandler of how such a class can be used in the logging context. bp delayed-message-translation Change-Id: I8485a346d32925327ea9185e0da3822e4e19c2f5
* Support overriding oslo localedir tooMark McLoughlin2013-04-031-3/+3
| | | | | | | | | | | | | | | | | | | | Part of fixing bug #995287 Libraries need to translate strings according to their translation domain but they should not override the default _() builtin (which should only be installed by the top-level script) and instead should gettextutils._(). To support the case where message catalogs are installed in a non-default (and perhaps project-specific) location, we allow the default localedir to be override with a project-specific environment variable e.g. QUANTUMCLIENT_LOCALEDIR. The code makes it seem like OSLO_LOCALEDIR is the env variable we're adding but, in fact, update.py magically replaces 'oslo' with the project name. Change-Id: I62b66892a4e27892ee488d2884ffd2f40ab467ee
* Add a gettextutils.install() helper functionMark McLoughlin2013-04-031-0/+17
| | | | | | | | | | | | | | | | | | | Part of fixing bug #995287 Every top-level script in every project needs to call gettext.install() so that a _() builtin function is installed and strings are translated using the correct translation domain. However, translations are always installed in the default localedir (which is commonly '/usr/share/locale') and, in cases like devstack, may be found in a project-specific localedir. To support such a use case we should have project-specific environment variables for overriding the default value of localedir - e.g. NOVA_LOCALEDIR. Add a new gettextutils.install() helper method to make this as easy as possible for projects to get right. Change-Id: I6c8549c8ff00797c96f2dd4b0b5266d18d77aa19
* gettextutils: fix translation domainMark McLoughlin2013-03-251-1/+1
| | | | | | | | | | | | | | | Fixes bug #1076285 When oslo-incubator code gets copied into a project, the project's l10n infrastructure will extract translatable messages from the oslo code into the project's message catalog. Translations of those messages will not be found if we use 'openstack.common' as the translation domain. Instead, use 'oslo' as the translation domain and update.py will change this to the project name. Change-Id: I7ab46c4f860c9c307758ab63002ae410e4f975fe
* Add gettext support.Russell Bryant2012-06-061-0/+33
This patch adds gettext support for openstack-common modules. In the process of pulling in the rpc code, I didn't want to remove the usage of _() that was already in there. This allows it to stay in a way that doesn't conflict with gettext usage in the project using openstack-common. Change-Id: I9cad006f81244f0cce7b7f28659fa1daa5a4268a