Static messages are not localized when requested

Bug #1215192 reported by Brant Knudson on 2013-08-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Low
Brant Knudson

Bug Description

Messages created at import-time are not being translated when
the request is made with Accept-Language.

Note that messages created a run-time are being translated.

Since not many messages are translated at this point, to recreate
can set a translated message yourself. For example, update
keystone/keystone/locale/it_IT/LC_MESSAGES/keystone.po:

 #: keystone/exception.py:101
 msgid "The request you have made requires authentication."
 msgstr "Wonderful Italian rendition of this"

before running `python setup.py compile_catalog`

Then run Keystone and request a resource that requires authentication.

curl -s -H "Accept-Language: it" http://localhost:5000/v3/auth/tokens | python -mjson.tool

{
    "error": {
        "code": 401,
        "message": "The request you have made requires authentication.",
        "title": "Unauthorized"
    }
}

-- this should return

{
    "error": {
        "code": 401,
        "message": "Wonderful Italian rendition of this",
        "title": "Unauthorized"
    }
}

Brant Knudson (blk-u) on 2013-08-21
Changed in keystone:
assignee: nobody → Brant Knudson (blk-u)

Fix proposed to branch: master
Review: https://review.openstack.org/43208

Changed in keystone:
status: New → In Progress
Dolph Mathews (dolph) on 2013-08-26
Changed in keystone:
importance: Undecided → Low

Reviewed: https://review.openstack.org/43208
Committed: http://github.com/openstack/keystone/commit/2fe72a0d5786ad633daea769ddbbd2e2d9be2406
Submitter: Jenkins
Branch: master

commit 2fe72a0d5786ad633daea769ddbbd2e2d9be2406
Author: Brant Knudson <email address hidden>
Date: Wed Aug 21 18:30:56 2013 -0500

    Fix translate static messages in response

    Messages created statically (during import) were not being
    translated in responses when the Accept-Language header was
    used to set the expected language in the response. The static
    messages were being created before the _ built-in had been
    installed by gettextutils.install().

    Change-Id: Ie56b1d3a836bc5f2262d7af68f803a08ebdf016f
    Resolves-Bug: #1215192

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-09-05
Changed in keystone:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in keystone:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers