i18n: Simplified Chinese (zh-hans) interface catalog

The zh-hans catalog, registered as 简体中文: zh-CN, zh-SG, zh-Hans-* and
a bare zh locale resolve to it (tested), and it claims complete menus.
NOTICE lists the craft-fonts faces of the current manifest (Noto Sans CJK
SC and Noto Sans Arabic were missing).

Landed from #303 (catalog, registration, locale tests and the NOTICE
line only). Its horizontal CJK composition, UI font fallback by weight,
dock, New Document, Brushes panel and preference-migration changes are
left for separate pull requests.
This commit is contained in:
Pengjingyu1992 authored and bflatastic committed 2026-10-08 05:28:49 +07:00
1 parent 3121bba275
commit 1e4db64362
4 files changed
+3132 -4

No files matched your search

+3 -2
View File
@@ -31,8 +31,9 @@ WebAssembly plug-ins run in the wasmi interpreter (MIT OR Apache-2.0); its wasmp
under the Apache License 2.0 with the LLVM exception.
Builds made with craft-fonts (the CRAFT_FONTS_DIR build option; all official releases) embed the
fonts listed in https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md (today BIZ
UDPGothic, Shippori Mincho and BIZ UDMincho; web builds BIZ UDPGothic Regular only) under the SIL
fonts listed in https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md (BIZ UDPGothic,
Shippori Mincho, BIZ UDMincho, Noto Sans CJK SC and Noto Sans Arabic in the current manifest;
web builds BIZ UDPGothic Regular only) under the SIL
Open Font License 1.1. Their license texts ship with the release packages as OFL-<family>.txt.
PDF import decodes CJK text with Adobe's CMap resources (https://github.com/adobe-type-tools/cmap-resources),
+9 -1
View File
@@ -60,7 +60,7 @@ fn plural_czech(n: u64) -> usize {
}
/// The registry. English first: it is the fallback and the source language.
pub static LANGUAGES: [LangInfo; 5] = [
pub static LANGUAGES: [LangInfo; 6] = [
LangInfo { code: "en", name: "English", source: "", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() },
// Japanese: the whole interface (every menu string and `tl!` literal), keeping the product,
// workspace and perspective preset names in English (`MENU_KEEP_AS_IS`).
@@ -88,6 +88,14 @@ pub static LANGUAGES: [LangInfo; 5] = [
complete_menus: true,
catalog: OnceLock::new(),
},
LangInfo {
code: "zh-hans",
name: "简体中文",
source: include_str!("zh-hans.tsv"),
plural: plural_none,
complete_menus: true,
catalog: OnceLock::new(),
},
];
impl LangInfo {
+2 -1
View File
@@ -23,7 +23,7 @@ fn tags_map_to_languages() {
// Simplified Chinese locales never pick up the Traditional catalog (they resolve to a
// `zh-hans` catalog once one is registered, and to English until then).
for tag in ["zh-CN", "zh_CN.UTF-8", "zh_SG", "zh-Hans", "zh-Hans-CN", "zh"] {
assert_ne!(lang_from_tag(tag), Some(ZH()), "{tag}");
assert_eq!(lang_from_tag(tag), Lang::from_code("zh-hans"), "{tag}");
}
assert_eq!(lang_from_tag(""), None);
assert_eq!(lang_from_tag("_"), None);
@@ -51,6 +51,7 @@ fn os_language_lists_are_parsed() {
#[test]
fn preferences_resolve_with_fallback() {
assert_eq!(Lang::from_pref("zh-Hans"), Lang::from_code("zh-hans").unwrap());
assert_eq!(Lang::from_pref("zh-hant"), ZH());
assert_eq!(Lang::from_pref("ZH-Hant"), ZH());
assert_eq!(Lang::from_pref("en"), Lang::EN);
File diff suppressed because it is too large. Load diff