Merge "Remove babel.cfg"
This commit is contained in:
commit
4b3efbc026
@ -33,7 +33,6 @@ Contributor Documentation
|
||||
auth-plugins.rst
|
||||
database-migrations.rst
|
||||
id-manage.rst
|
||||
translated-responses.rst
|
||||
architecture.rst
|
||||
services.rst
|
||||
developing-drivers.rst
|
||||
|
@ -1,52 +0,0 @@
|
||||
..
|
||||
Copyright 2011-2012 OpenStack Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may obtain
|
||||
a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
Translated responses
|
||||
====================
|
||||
|
||||
The Keystone server can provide error responses translated into the language in
|
||||
the ``Accept-Language`` header of the request. In order to test this in your
|
||||
development environment, there's a couple of things you need to do.
|
||||
|
||||
1. Build the message files. Run the following command in your keystone
|
||||
directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ python setup.py compile_catalog
|
||||
|
||||
This will generate .mo files like keystone/locale/[lang]/LC_MESSAGES/[lang].mo
|
||||
|
||||
2. When running Keystone, set the ``KEYSTONE_LOCALEDIR`` environment variable
|
||||
to the keystone/locale directory. For example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ KEYSTONE_LOCALEDIR=/opt/stack/keystone/keystone/locale uwsgi --http 127.0.0.1:5000 --wsgi-file $(which keystone-wsgi-public)
|
||||
|
||||
|
||||
Now you can get a translated error response:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ curl -s -H "Accept-Language: zh" http://localhost:5000/notapath | python -mjson.tool
|
||||
{
|
||||
"error": {
|
||||
"code": 404,
|
||||
"message": "\u627e\u4e0d\u5230\u8cc7\u6e90\u3002",
|
||||
"title": "Not Found"
|
||||
}
|
||||
}
|
16
setup.cfg
16
setup.cfg
@ -40,22 +40,6 @@ mongodb =
|
||||
bandit =
|
||||
bandit>=1.1.0 # Apache-2.0
|
||||
|
||||
[compile_catalog]
|
||||
directory = keystone/locale
|
||||
domain = keystone
|
||||
|
||||
[update_catalog]
|
||||
domain = keystone
|
||||
output_dir = keystone/locale
|
||||
input_file = keystone/locale/keystone.pot
|
||||
|
||||
[extract_messages]
|
||||
keywords = _ gettext ngettext l_ lazy_gettext
|
||||
mapping_file = babel.cfg
|
||||
output_file = keystone/locale/keystone.pot
|
||||
copyright_holder = OpenStack Foundation
|
||||
msgid_bugs_address = https://bugs.launchpad.net/keystone
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
keystone-manage = keystone.cmd.manage:main
|
||||
|
Loading…
Reference in New Issue
Block a user