yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #13144
[Bug 1288049] Re: Lazy translation fails for complex formatting
** Changed in: oslo
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1288049
Title:
Lazy translation fails for complex formatting
Status in OpenStack Compute (Nova):
Confirmed
Status in Oslo - a Library of Common OpenStack Code:
Fix Released
Bug description:
When lazy translation is enabled _() returns a gettextutils.Message
instance. When formatting (%) is called on the instance rather than
apply the replacement values, it gathers them so they can be applied
when the message is lazily translated. This support includes the use
of keyword replacement as part of formatting (passing a dictionary).
In order to limit the size of the dictionary, especially in the case
where locales is passed, the dictionary of values is limited to only
those keywords that are actually referenced in the format string.
The code that extracts the replacement keys (and thus dictionary
entries to keep) only handles simple formatting. Currently it does
not handle things like '%(key).02f', but instead omits them from the
dictionary, which causes a KeyError when the message is translated and
the replacements applied.
Confirmed that regex that extracts the keywords does not handle this case:
https://github.com/openstack/oslo-incubator/blob/master/openstack/common/gettextutils.py#L266
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1288049/+subscriptions