Cannot assign different translations for present and past message of BatchAction
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
Fix Released
|
Medium
|
Akihiro Motoki | ||
Havana |
Fix Released
|
Medium
|
Akihiro Motoki |
Bug Description
Message strings of BatchAction (including DeleteAction) is generated in _conjugate of BatchAction in horizon/
Iin some languages (at least Japanese) we need to use different translated strings for "present" and "past" message strings, but The same string "%(action)s %(data_type)s" is used to generate them. As a result, either of "present" or "past" message string may become odd translation string (e.g., Havana Horizon translation in Japanese has some odd strings due to this issue).
At least it is better "present" and "past" message strings can be distinguished.
From translation perspective, it is ideal we can define "present" and "past" strings respectively for each action class rather than generating strings in _conjugate(). Translator need to use different strings based on action types. It will be filed as a separate bug.
My idea is to use contextual marker [1] to distinguish them.
I would like to hear opinions before proposing a patch.
@@ -557,8 +558,11 @@ class BatchAction(
else:
- return _("%(action)s %(data_type)s") % {'action': action,
- 'data_type': data_type}
+ if action_type == "past":
+ msgstr = pgettext_
+ else:
+ msgstr = pgettext_
+ return msgstr % {'action': action, 'data_type': data_type}
def action(self, request, datum_id):
"""
After this, we can get the following entries in the PO file and assign different translations to "past" and "present" strings.
#: tables/
#, python-format
msgctxt "past"
msgid "%(action)s %(data_type)s"
msgstr ""
#: tables/
#, python-format
msgctxt "present"
msgid "%(action)s %(data_type)s"
msgstr ""
[1] https:/
Changed in horizon: | |
status: | New → Confirmed |
summary: |
- Message string of BatchAction is hard to translate + Cannot assign different translations for present and past message of + BatchAction |
tags: | added: havana-backport-potential |
Changed in horizon: | |
importance: | Undecided → Medium |
milestone: | none → icehouse-1 |
tags: | removed: havana-backport-potential |
Changed in horizon: | |
status: | Fix Committed → Fix Released |
Changed in horizon: | |
milestone: | icehouse-1 → 2014.1 |
This looks good to me, it seems useful and quite low impact in terms of changing the current code. If it helps the dashboard have more natural sounding translations when used in other languages we should do it :-)
It may be good to also ask the i18n team for their input and the impact on other languages?
In general I worry about having a "_conjugate()" method in the code, this makes a lot of assumptions on language. Perhaps we should also work on a separate longer term solution.