Skip to content

Commit a08584e

Browse files
authored
Ensure that Chinese punctuation is not ambiguous when locale is Chinese (#22019)
Although there are per-locale fallbacks for ambiguity the locale names for Chinese do not quite match our locales. This PR simply maps zh-CN on to zh-hans and other zh variants on to zh-hant. Ref #20999 Signed-off-by: Andrew Thornton <[email protected]>
1 parent ea86c2b commit a08584e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: modules/charset/ambiguous.go

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func AmbiguousTablesForLocale(locale translation.Locale) []*AmbiguousTable {
2828
key = key[:idx]
2929
}
3030
}
31+
if table == nil && (locale.Language() == "zh-CN" || locale.Language() == "zh_CN") {
32+
table = AmbiguousCharacters["zh-hans"]
33+
}
34+
if table == nil && strings.HasPrefix(locale.Language(), "zh") {
35+
table = AmbiguousCharacters["zh-hant"]
36+
}
3137
if table == nil {
3238
table = AmbiguousCharacters["_default"]
3339
}

0 commit comments

Comments
 (0)