"Detach Volume" is unlocalized Project > Instances action menu, window title and button

Bug #1626312 reported by Yuko Katabami
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Akihiro Motoki

Bug Description

openstack_dashboard/dashboards/project/instances/tables.py:937
openstack_dashboard/dashboards/project/instances/views.py:489
openstack_dashboard/dashboards/project/instances/views.py:491

The string "Detach Volume" is unlocalized in 3 places:
1. Action menu
2. Window title
3. Action button in the window

The same text appears in Manager Attachments on the Volumes tab is localized
(openstack_dashboard/dashboards/project/volumes/volumes/tables.py:521)

Revision history for this message
Yuko Katabami (ykatabam) wrote :
Revision history for this message
Yuko Katabami (ykatabam) wrote :
Sai Kiran (saikiran)
Changed in horizon:
assignee: nobody → Sai Kiran (saikiran)
Revision history for this message
Akihiro Motoki (amotoki) wrote :

This seems to hit gettext bug or gettext intended behavior.
We use ungettext_lazy for "Detach Volume" in openstack_dashboard/dashboards/project/volumes/volumes/tables.py and _ (ugettext_lazy) for "Detach Volume" in other places.

In the extracted message catalog, "Detach Volume" is a single record.

#: openstack_dashboard/dashboards/project/instances/tables.py:937
#: openstack_dashboard/dashboards/project/instances/views.py:489
#: openstack_dashboard/dashboards/project/instances/views.py:491
#: openstack_dashboard/dashboards/project/volumes/volumes/tables.py:521
msgid "Detach Volume"
msgid_plural "Detach Volumes"
msgstr[0] ""
msgstr[1] ""

and a corresponding entry in Japanese translation is as follows:

#: openstack_dashboard/dashboards/project/instances/tables.py:937
#: openstack_dashboard/dashboards/project/instances/views.py:489
#: openstack_dashboard/dashboards/project/instances/views.py:491
#: openstack_dashboard/dashboards/project/volumes/volumes/tables.py:521
msgid "Detach Volume"
msgid_plural "Detach Volumes"
msgstr[0] "ボリュームの切断"

However, unfortunately, when translation conversion, _ (ugettext_lazy) does not look up an entry with plural definition. As a result, the above translated entry is not found and an English version is displayed.

Changed in horizon:
status: New → Triaged
importance: Undecided → Medium
tags: added: newton-backport-potential
Revision history for this message
Akihiro Motoki (amotoki) wrote :

Sai, do you have a solution?
I can propose a workaround on this. Can I take it over?

Akihiro Motoki (amotoki)
tags: added: i18n
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
assignee: Sai Kiran (saikiran) → Akihiro Motoki (amotoki)
status: Triaged → In Progress
Changed in horizon:
milestone: none → ocata-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/375916
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=7d8d1fa7cd6757ee122a1b706519ad015ecd07bf
Submitter: Jenkins
Branch: master

commit 7d8d1fa7cd6757ee122a1b706519ad015ecd07bf
Author: Akihiro Motoki <email address hidden>
Date: Sun Sep 25 00:29:14 2016 +0000

    Make "Detach Volume" in Instances page translatable

    Due to tricky behavior of gettext, if we have both normal
    gettext string and plural gettext string for a same string,
    the normal gettext string is not translated.
    (The detail is described in the bug report. See comment #5.)

    As a workaround, this commit adds a context information to
    the plural gettext string in volumes.volumes.tables.DetachVolume
    so that we can have separate entries for a normal entry and
    an entry with plural form support. By doing so, gettext can
    find an expected translated string for a normal string.

    After this change, we will see the following entries
    for "Detach Volume" in the generated PO file.
    ----
    msgid "Detach Volume"
    msgstr ""

    msgctxt "Action to perform (the volume is currently attached)"
    msgid "Detach Volume"
    msgid_plural "Detach Volumes"
    msgstr[0] ""
    msgstr[1] ""
    ----

    Note that the message "Detaching Volume" for the post action
    in the table is also updated to use npgettext_lazy.
    This and "Detach Volume" are a pair, so it looks better to
    use a same style.

    Change-Id: Idf772265d3e0e1d2e74b19755a467e1433233f64
    Closes-Bug: #1626312

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 11.0.0.0b1

This issue was fixed in the openstack/horizon 11.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/402106

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/newton)

Reviewed: https://review.openstack.org/402106
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=0cee7bcf80d82b1244b114539ce69ad754f061e1
Submitter: Jenkins
Branch: stable/newton

commit 0cee7bcf80d82b1244b114539ce69ad754f061e1
Author: Akihiro Motoki <email address hidden>
Date: Sun Sep 25 00:29:14 2016 +0000

    Make "Detach Volume" in Instances page translatable

    Due to tricky behavior of gettext, if we have both normal
    gettext string and plural gettext string for a same string,
    the normal gettext string is not translated.
    (The detail is described in the bug report. See comment #5.)

    As a workaround, this commit adds a context information to
    the plural gettext string in volumes.volumes.tables.DetachVolume
    so that we can have separate entries for a normal entry and
    an entry with plural form support. By doing so, gettext can
    find an expected translated string for a normal string.

    After this change, we will see the following entries
    for "Detach Volume" in the generated PO file.
    ----
    msgid "Detach Volume"
    msgstr ""

    msgctxt "Action to perform (the volume is currently attached)"
    msgid "Detach Volume"
    msgid_plural "Detach Volumes"
    msgstr[0] ""
    msgstr[1] ""
    ----

    Note that the message "Detaching Volume" for the post action
    in the table is also updated to use npgettext_lazy.
    This and "Detach Volume" are a pair, so it looks better to
    use a same style.

    Change-Id: Idf772265d3e0e1d2e74b19755a467e1433233f64
    Closes-Bug: #1626312
    (cherry picked from commit 7d8d1fa7cd6757ee122a1b706519ad015ecd07bf)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 10.0.2

This issue was fixed in the openstack/horizon 10.0.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.