Bug 1907543

Summary: Korean timestamps are shown when users' language preferences are set to German-en-en-US
Product: OpenShift Container Platform Reporter: ralpert
Component: Management ConsoleAssignee: ralpert
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: high    
Version: 4.7CC: aballant, aos-bugs, cjerolim, jokerman, yanpzhan
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:43:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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