From b741881729f6d343ef5e34f4eb80237b045214f9 Mon Sep 17 00:00:00 2001 From: Missing_Love <42416195+Q2297045667@users.noreply.github.com> Date: Sat, 16 Aug 2025 23:23:49 +0800 Subject: [PATCH] Added some Simplified Chinese translations. (#1129) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added some Simplified Chinese translations. This is my first Pumpkin PR, and it means the world to me. (≧∇≦)🎃 * Added Simplified Chinese * Added Simplified Chinese --- assets/translations/zh_cn.json | 12 ++++++++++++ pumpkin-util/src/translation.rs | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 assets/translations/zh_cn.json diff --git a/assets/translations/zh_cn.json b/assets/translations/zh_cn.json new file mode 100644 index 000000000..e0377627f --- /dev/null +++ b/assets/translations/zh_cn.json @@ -0,0 +1,12 @@ +{ + "commands.pumpkin.version": "Pumpkin %s\n", + "commands.pumpkin.description": "赋予每个人托管快速高效的 \nMinecraft 服务器的能力。\n", + "commands.pumpkin.minecraft_version": "(Minecraft %1$s, 协议 %2$s)\n", + "commands.pumpkin.github": "[GitHub 仓库]", + "commands.pumpkin.website": "[网页]", + "commands.pumpkin.version.hover": "点击以复制版本。", + "commands.pumpkin.description.hover": "点击以复制描述。", + "commands.pumpkin.minecraft_version.hover": "点击以复制 Minecraft 的版本。", + "commands.pumpkin.github.hover": "点击以打开仓库。", + "commands.pumpkin.website.hover": "点击以打开网页。" +} \ No newline at end of file diff --git a/pumpkin-util/src/translation.rs b/pumpkin-util/src/translation.rs index 052412a8c..d7241315e 100644 --- a/pumpkin-util/src/translation.rs +++ b/pumpkin-util/src/translation.rs @@ -17,6 +17,7 @@ use crate::text::{TextComponentBase, TextContent, style::Style}; static VANILLA_EN_US_JSON: &str = include_str!("../../assets/en_us.json"); static PUMPKIN_EN_US_JSON: &str = include_str!("../../assets/translations/en_us.json"); static PUMPKIN_ES_ES_JSON: &str = include_str!("../../assets/translations/es_es.json"); +static PUMPKIN_ZH_CN_JSON: &str = include_str!("../../assets/translations/zh_cn.json"); #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] pub struct SubstitutionRange { @@ -188,6 +189,8 @@ pub static TRANSLATIONS: LazyLock; Locale::last() serde_json::from_str(PUMPKIN_EN_US_JSON).expect("Could not parse en_us.json."); let pumpkin_es_es: HashMap = serde_json::from_str(PUMPKIN_ES_ES_JSON).expect("Could not parse es_es.json."); + let pumpkin_zh_cn: HashMap = + serde_json::from_str(PUMPKIN_ZH_CN_JSON).expect("Could not parse zh_cn.json."); for (key, value) in vanilla_en_us { array[Locale::EnUs as usize].insert(format!("minecraft:{key}"), value); @@ -198,6 +201,9 @@ pub static TRANSLATIONS: LazyLock; Locale::last() for (key, value) in pumpkin_es_es { array[Locale::EsEs as usize].insert(format!("pumpkin:{key}"), value); } + for (key, value) in pumpkin_zh_cn { + array[Locale::ZhCn as usize].insert(format!("pumpkin:{key}"), value); + } Mutex::new(array) });