I18n: Localization of the role "Member"

Bug #1255004 reported by Ying Chun Guo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Zhenguo Niu
Havana
Fix Released
Low
Akihiro Motoki
openstack i18n
Fix Released
Undecided
Unassigned

Bug Description

Hi,

There is a very strange thing happened to role "Member" when I set Horizon to use my local language.

In the dialog "Domain Groups", it is translated. But in the dialog of "Project Members" and "Project Groups", it is not translated.

From my point of view, if we can localize role names, it will be wonderful. If we are not able to localize role names, it is acceptable. But we need to make them consistent.

Hope somebody can take a look at this interested issue.

Thanks.
Daisy

Tags: i18n
Revision history for this message
Julie Pichon (jpichon) wrote :

It sounds similar to bug 1226510 - role names are manually defined by the cloud administrator and we shouldn't try to translate them. It so happens that the default role is called 'Member' in English in the test environment, no matter the language - but the administrator could choose something else in any language, as this is a user-defined value coming from the Keystone database, not a Horizon string.

I think the proper fix would be to not mark them as translatable anywhere, in line with the fix for bug 1226510.

Julie Pichon (jpichon)
Changed in horizon:
status: New → Confirmed
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I agree that such strings should not be marked as translatable.

IMO, _() should be used only for string literals and should not be used for variables (in this case "_(role.name)"). In Horizon _ is evaluated in lazy mode and it leads to unpredictable results (i.e., if we have a corresponding entry in PO file a string will be displayed using localized string, otherwise a English string is displayed).

According to grep result, the following can be a problem.
(The first one is a bit different though)

horizon/exceptions.py:172: return _(self.msg) % self.attrs
openstack_dashboard/dashboards/admin/domains/workflows.py:106: label = _(role.name)
openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py:250: common_rules = [(k, _(rules_dict[k]['name']))

Revision history for this message
Zhenguo Niu (niu-zglinux) wrote :

Agree, they should not be translated.

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/58540

Changed in horizon:
assignee: nobody → Zhenguo Niu (niu-zglinux)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/58540
Committed: http://github.com/openstack/horizon/commit/8ed32cc2785ffffbdcc0a2f0f745c10a226560fa
Submitter: Jenkins
Branch: master

commit 8ed32cc2785ffffbdcc0a2f0f745c10a226560fa
Author: Zhenguo Niu <email address hidden>
Date: Tue Nov 26 22:43:50 2013 +0800

    Role name should not be translated in Domain Groups dialog

    Role names are retrieved from keystone and they should be displayed
    as-is.

    Change-Id: I62f9cb5582090e197fe2b7b434107dc801864571
    Closes-Bug: #1255004

Changed in horizon:
status: In Progress → Fix Committed
Julie Pichon (jpichon)
tags: added: havana-backport-potential
Akihiro Motoki (amotoki)
Changed in horizon:
importance: Undecided → Low
milestone: none → icehouse-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/havana)

Fix proposed to branch: stable/havana
Review: https://review.openstack.org/59637

Akihiro Motoki (amotoki)
tags: removed: havana-backport-potential
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/havana)

Reviewed: https://review.openstack.org/59637
Committed: http://github.com/openstack/horizon/commit/27e9563d61f364560bc5c50b92ccd4d8cf5f7e76
Submitter: Jenkins
Branch: stable/havana

commit 27e9563d61f364560bc5c50b92ccd4d8cf5f7e76
Author: Zhenguo Niu <email address hidden>
Date: Tue Nov 26 22:43:50 2013 +0800

    Role name should not be translated in Domain Groups dialog

    Role names are retrieved from keystone and they should be displayed
    as-is.

    Change-Id: I62f9cb5582090e197fe2b7b434107dc801864571
    Closes-Bug: #1255004
    (cherry picked from commit 8ed32cc2785ffffbdcc0a2f0f745c10a226560fa)

Akihiro Motoki (amotoki)
Changed in openstack-i18n:
status: New → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-1 → 2014.1
Changed in openstack-i18n:
status: Fix Committed → Fix Released
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.