Skip to content

Commit b3ddfca

Browse files
committed
Ensure that Chinese punctuation is not ambiguous when locale is Chinese (go-gitea#22019)
Backport go-gitea#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 go-gitea#20999 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 757b49e commit b3ddfca

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/charset/ambiguous.go

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

0 commit comments

Comments
 (0)