diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-08-18 22:30:05 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-08-18 22:30:05 +0000 |
commit | 9c92d27937f733645631eb43a1ad48bae78d630c (patch) | |
tree | 85dbaa61d42caf06246d90d97c0deeba943763ce /doc | |
parent | 14cba15fcb9a03adb82bbe586f6431791077f1e8 (diff) | |
parent | 760856e9669b0af20909c56d4a5a082bd4d7e450 (diff) | |
download | keystone-9c92d27937f733645631eb43a1ad48bae78d630c.tar.gz keystone-9c92d27937f733645631eb43a1ad48bae78d630c.tar.xz keystone-9c92d27937f733645631eb43a1ad48bae78d630c.zip |
Merge "Add support for API message localization"
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/developing.rst | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/source/developing.rst b/doc/source/developing.rst index 7029e1c8..312d7892 100644 --- a/doc/source/developing.rst +++ b/doc/source/developing.rst @@ -228,6 +228,37 @@ installed devstack with a different LDAP password, modify the file ``keystone/tests/backend_liveldap.conf`` to reflect your password. +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:: + + $ 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:: + + $ KEYSTONE_LOCALEDIR=/opt/stack/keystone/keystone/locale keystone-all + +Now you can get a translated error response:: + + $ 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" + } + } + + Building the Documentation ========================== |