Bug 1907543 - Korean timestamps are shown when users' language preferences are set to German-en-en-US
Summary: Korean timestamps are shown when users' language preferences are set to Germa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: 4.7.0
Assignee: ralpert
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-14 17:06 UTC by ralpert
Modified: 2021-02-24 15:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: We use Moment.js for timestamps. There was no default language set for Moment.js. If we didn't support the language being displayed, Moment seemed to default to the last imported locale. Consequence: Korean timestamps were displayed since it was the last imported locale. Fix: Added English as a default. Result: English and English timestamps are now shown if the user tries to use OpenShift in a language we don't support.
Clone Of:
Environment:
Last Closed: 2021-02-24 15:43:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 7545 0 None closed Bug 1907543: Set "en" as default for Moment.js 2020-12-21 08:12:37 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:44:00 UTC

Description ralpert 2020-12-14 17:06:37 UTC
Description of problem:
Korean timestamps are shown when users' language preferences are set to (in order of priority): German (de), English (en), and English-U.S. (en-U.S.).

The issue was also reported by Christoph Jerolimov using de-DE,de;q=0.9,en-DE;q=0.8,en;q=0.7,en-US;q=0.6.

Version-Release number of selected component (if applicable):
4.7

How reproducible:
Always

Steps to Reproduce:
1. Clear local storage.
2. Set browser language preferences to German, English, and Enlish-U.S.

Actual results:
The application is shown in English with Korean timestamps.

Expected results:
The application is shown in English.

Additional info:
Console messages show that i18next::backendConnector language en and then registered a languageChanged event for de as expected.

Comment 1 ralpert 2020-12-14 17:43:04 UTC
This appears to happen for other language we don't offer support for (I checked Spanish as well).

Comment 2 ralpert 2020-12-14 18:56:11 UTC
It looks like Moment.js is the source of the Korean timestamps issue -- it's reporting that it's in Korean. I'm looking into the way we're using it for interpolation to see if I can find the source of the issue. i18next browser detection is working as intended and i18next is reporting that it's using German as expected.

Comment 3 ralpert 2020-12-14 19:12:21 UTC
Moment is showing timestamps in Korean because it was the most recently imported Moment.js locale. Changing the imports so Chinese is the last will mean the timestamps are in Chinese.

I suspect this was caused by a relatively recent switch to hard-coding the languages instead of using a single data structure across the application. We switched because it was causing issues with the parser. I think Moment doesn't know how to handle locales we haven't specifically imported and requires us to set a default.

Comment 6 Yanping Zhang 2020-12-21 11:42:15 UTC
Checked on ocp 4.7 cluster with payload 4.7.0-0.nightly-2020-12-20-031835.
Set browser language preferences to German, English, Chinese, open the console, it shows contexts in English by default now and timestamps are correct.

Comment 8 errata-xmlrpc 2021-02-24 15:43:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:5633


Note You need to log in before you can comment on or make changes to this bug.