Impossible to change language in user settings to Chinese

Bug #1818639 reported by Radomir Dopieralski
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Critical
Radomir Dopieralski

Bug Description

We use translation.check_for_language() function to validate the language code in our user settings form, however the way that function works bypasses the language code alias mechanisms, making it not work with the old zh_CN and zh_TW language codes, which have been replaced with zh_Hans and zh_Hant in Django. This is compounded with another bug in that function (https://code.djangoproject.com/ticket/28755), which made it work sometimes, if the process was started in the correct directory.

We have several options for fixing it:
1. Rename the Horizon translations for Chinese to match those of Django;
2. Use absolute paths in LOCALE_PATHS or let Django generate those;
3. Don't use check_for_language in the first place, as the field is already validated against the list of supported language codes from the settings.

Changed in horizon:
importance: Undecided → Critical
Changed in horizon:
assignee: nobody → Radomir Dopieralski (deshipu)
status: New → In Progress
Revision history for this message
Radomir Dopieralski (deshipu) wrote :

Note that the language can be set when horizon runs using the runserver command, because then the LOCALE_PATHS are valid relative paths, and check_for_language finds local Horizon translations. This doesn't work when run from Apache or other web server, as the paths are then incorrect. See https://code.djangoproject.com/ticket/28755 for details.

summary: - Chinese translations got renamed from zh-cn and zh-tw to zh-hans and zh-
- hant
+ Impossible to change language in user settings to Chinese
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Radomir Dopieralski (<email address hidden>) on branch: master
Review: https://review.openstack.org/640981

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

Reviewed: https://review.openstack.org/641054
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6372a689e20252e4a18a59a6ded8841bfa5ed004
Submitter: Zuul
Branch: master

commit 6372a689e20252e4a18a59a6ded8841bfa5ed004
Author: Radomir Dopieralski <email address hidden>
Date: Tue Mar 5 16:43:06 2019 +0100

    Don't use check_for_language in the user settings form

    That function is buggy and can't handle the Chinese language codes.

    Closes-Bug: #1818639
    Change-Id: I6ea03949f3ad6db82f5965de3fa028a84edf6cf3

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/641603

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

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/641604

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 15.0.0.0b2

This issue was fixed in the openstack/horizon 15.0.0.0b2 development milestone.

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

Reviewed: https://review.openstack.org/641603
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=24b6534022b10618e5b4de8c7d8493fb372e1b06
Submitter: Zuul
Branch: stable/rocky

commit 24b6534022b10618e5b4de8c7d8493fb372e1b06
Author: Radomir Dopieralski <email address hidden>
Date: Tue Mar 5 16:43:06 2019 +0100

    Don't use check_for_language in the user settings form

    That function is buggy and can't handle the Chinese language codes.

    Closes-Bug: #1818639
    Change-Id: I6ea03949f3ad6db82f5965de3fa028a84edf6cf3
    (cherry picked from commit 6372a689e20252e4a18a59a6ded8841bfa5ed004)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/queens)

Reviewed: https://review.openstack.org/641604
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=f315efa12c511fcf2afc6f19fc68d49f9169f2aa
Submitter: Zuul
Branch: stable/queens

commit f315efa12c511fcf2afc6f19fc68d49f9169f2aa
Author: Radomir Dopieralski <email address hidden>
Date: Tue Mar 5 16:43:06 2019 +0100

    Don't use check_for_language in the user settings form

    That function is buggy and can't handle the Chinese language codes.

    Closes-Bug: #1818639
    Change-Id: I6ea03949f3ad6db82f5965de3fa028a84edf6cf3
    (cherry picked from commit 6372a689e20252e4a18a59a6ded8841bfa5ed004)

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 14.0.3

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

Revision history for this message
Gloria Gu (gloria-gu) wrote :

@Radomir Dopieralski @Akihiro Motoki I tried fixes in our lab cloud. It seems to fix the issue when switch to simplified chinese (zh-cn) and other languages where the settings saved and correct languages are shown. However, if try to switch to zh-tw which is traditional Chinese, it only switches to simplified chinese instead of traditional chinese. Not sure you guys see the same issue.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Gloria, is your topic related to https://bugs.launchpad.net/horizon/+bug/1830886 ?
I assigned myself but failed to find time to dig into the detail so far.
It would be nice if you can investigate it.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/666602

Revision history for this message
Gloria Gu (gloria-gu) wrote :

@Akihiro, looks like that one is the same as mine. Ivan seems to work on that. I will check with him. By the way, I can not get on hexchat horizon channel anymore, it requests me to register, but after register, it indicates I will get an email to finish, but I never get an email regarding that matters. Not sure what is going on and what I need to do. If you know please let me know. Thanks.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to horizon (master)

Reviewed: https://review.opendev.org/666602
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=4e911e2889ebe7f0a577a0323649dceb9cef363c
Submitter: Zuul
Branch: master

commit 4e911e2889ebe7f0a577a0323649dceb9cef363c
Author: Ivan Kolodyazhny <email address hidden>
Date: Thu Jun 20 14:55:48 2019 +0000

    Explicitly set LOCALE_PATHS for Horizon apps

    Set absolute paths in the LOCALE_PATHS configuration param to allow
    Django work with current supported locales.

    Change-Id: I62fffe04860b7b4b63f227ad99729ab4e8384d8f
    Related-Bug: #1818639
    Closes-Bug: #1830886

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/667041

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/667640

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/stein)

Change abandoned by Ivan Kolodyazhny (<email address hidden>) on branch: stable/stein
Review: https://review.opendev.org/667041

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Ivan Kolodyazhny (<email address hidden>) on branch: master
Review: https://review.opendev.org/667640

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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