-
Notifications
You must be signed in to change notification settings - Fork 69
Correctly handle the "zh-Hans" language (bsc#1238584) #2314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
e7ffbe3
Correctly handle the "zh-Hans" language (bsc#1238584)
lslezak 1761d09
remove zh_Hans conversions
lslezak 01aab00
Temporarily decrease the translation threshold
lslezak 80d6724
Update web translation files
yast-bot 30efeca
Update web translation files (#2325)
lslezak ff59cd1
Fix test
lslezak cf09453
Update changes
lslezak 84fc559
Use "-" language separator everywhere in the web frontend
lslezak 23d60ae
Fixed PO convertor
lslezak db92a08
Update unit test
lslezak 97a22da
Fix locale filtering
lslezak d000071
Fix locale filtering
lslezak 8877c57
keep only the UTF-8 locales
lslezak c20b1d6
Update changes
lslezak 990c94a
Fixed packaging
lslezak ad62d2d
Live ISO optimizations
lslezak 75bb493
Log the current language
lslezak b7cf3e4
Fix spec install
lslezak 1279a9c
Restore back the 70% translation threshold
lslezak 6505471
Merge remote-tracking branch 'origin/master' into locale_fixes
lslezak 205438e
Update changes
lslezak 83a3e05
Update live/src/config.sh
lslezak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| ------------------------------------------------------------------- | ||
| Wed Apr 30 11:14:55 UTC 2025 - Ladislav Slezák <[email protected]> | ||
|
|
||
| - Fixed locale cleanup to not delete all locales | ||
| - Correctly handle the "zh-Hans" language (bsc#1238584) | ||
|
|
||
| ------------------------------------------------------------------- | ||
| Tue Apr 29 11:30:59 UTC 2025 - Ladislav Slezák <[email protected]> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,10 @@ | ||
| ------------------------------------------------------------------- | ||
| Wed Apr 30 11:45:08 UTC 2025 - Ladislav Slezák <[email protected]> | ||
|
|
||
| - Use the correct locale format in the Intl.ListFormat.format call | ||
| (bsc#1238584) | ||
| - Set the "zh_CN" locale in backend for the "zh-Hans" language | ||
lslezak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ------------------------------------------------------------------- | ||
| Tue Apr 22 14:14:53 UTC 2025 - Imobach Gonzalez Sosa <[email protected]> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Copyright (c) [2025] SUSE LLC | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU General Public License as published by the Free | ||
| * Software Foundation; either version 2 of the License, or (at your option) | ||
| * any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| * more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License along | ||
| * with this program; if not, contact SUSE LLC. | ||
| * | ||
| * To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| * find current contact information at www.suse.com. | ||
| */ | ||
|
|
||
| import agama from "~/agama"; | ||
|
|
||
| describe("agama", () => { | ||
| describe("formatList", () => { | ||
| afterEach(() => { | ||
| // restore the default language | ||
| agama.language = "en"; | ||
| }); | ||
|
|
||
| it("it accepts a locale with underscore", () => { | ||
| agama.language = "zh_Hans"; | ||
lslezak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const list = agama.formatList(["1", "2", "3"], {}); | ||
| expect(list).toEqual("1、2和3"); | ||
| }); | ||
|
|
||
| it("it fallbacks to a simple formatting when the localized function fails", () => { | ||
| agama.language = "invalid:language"; | ||
| // disable the console logging in this test, a failure is expected so do | ||
| // not mess the output with a false alarm | ||
| jest.spyOn(console, "warn").mockImplementation(); | ||
| const list = agama.formatList(["1", "2", "3"], {}); | ||
| expect(list).toEqual("1, 2, 3"); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,7 +127,13 @@ function languageFromLocale(locale: string): string { | |
| * @see https://www.rfc-editor.org/info/bcp78 | ||
| */ | ||
| function languageToLocale(language: string): string { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please note there is also an inverse |
||
| const [lang, country] = language.split("-"); | ||
| let [lang, country] = language.split("-"); | ||
|
|
||
| // glibc does not know the "zh_HANS.UTF-8" locale, change it to "zh_CN.UTF-8" | ||
| if (country === "Hans") { | ||
| country = "CN"; | ||
| } | ||
lslezak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| const locale = country ? `${lang}_${country.toUpperCase()}` : lang; | ||
| return `${locale}.UTF-8`; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.