Skip to content

Commit

Permalink
clone support of lang zh
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiMiao committed Feb 3, 2021
1 parent 3df8112 commit 485671d
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.*/
build/
*~
*.bak
*.nro
*.nacp
*.elf
.vscode
203 changes: 203 additions & 0 deletions romfs/lang/zh-Hans.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"main":{
"menu": {
"sd": "通过 SD 卡安装",
"net": "通过局域网或互联网安装",
"usb": "通过 USB 安装",
"hdd": "通过 USB 硬盘安装",
"sig": "管理签名补丁",
"set": "设置",
"exit": "退出"
},
"hdd": {
"title": "USB 硬盘",
"notfound": "未连接 USB 硬盘。"
},
"net": {
"title": "网络连接不可用",
"desc": "请确认飞行模式已关闭,且已连接到本地网络。"
},
"usb": {
"warn": {
"title": "警告!",
"desc": "USB 安装在某些设备及环境下不一定能正常“将就使用”。\n如果您在使用 USB 安装时遇到问题,请不要心急!\n建议使用 NS-USBloader 来进行 USB 安装,\n或另行通过网络进行安装!\n\n特此警示。",
"opt1": "不再提示"
},
"error": {
"title": "未检测到 USB 连接",
"desc": "请通过 USB 连接到兼容设备"
}
},
"applet": {
"title": "不支持 Applet 模式",
"desc": "在 Applet 模式下使用 Tinleaf Installer 可能会遇到问题。\n若出现问题,请改以“软件替换”模式启动。\n(回到 \ue0f4 主菜单,按住 \ue0e5 并启动任意已安装游戏,进入 hbmenu 后再重新运行 Tinleaf Installer。)"
},
"buttons": "\ue0e0 选择 \ue0e1 退出"
},
"inst": {
"net": {
"help": {
"title": "帮助",
"desc": "可以从其他设备使用某些工具远程安装文件,如 NS-USBloader (Tinfoil 模式)。\n要向 Switch 发送文件,打开电脑或者移动设备上任一工具软件,\n输入屏幕上显示的 Switch IP 地址,选择文件,然后上传到您的主机。\n若您使用的工具软件不支持选择特定文件类型,您可以尝试更改为可接受的文件扩展名。\nTinleaf Installer 在通过网络安装时不限定文件扩展名。\n\n如果实在搞不懂,请复制文件到 SD 卡并尝试在主菜单中选择“通过 SD 卡安装”。"
},
"src": {
"title": "请选择安装来源",
"opt0": "URL (网络链接)",
"opt1": "Google 云端硬盘"
},
"url": {
"hint": "输入文件的链接地址 (URL)",
"invalid": "指定的URL地址无效!",
"source_string": " (来源: URL)"
},
"gdrive": {
"hint": "输入 Google 云盘公共文件的 ID",
"alt_name": "Google 云盘文件",
"source_string": " (来源: Google 云盘)"
},
"top_info": "在选择您要安装的文件,然后按 \ue0ef 键。",
"top_info1": "正在等待连接… 您 Switch 的 IP 地址是:",
"failed": "远程安装失败!",
"transfer_interput": "数据传输发生错误,请检查网络连接。",
"source_string": " (来源:本地网络)",
"buttons": "\ue0e3 互联网安装 \ue0e2 帮助 \ue0e1 取消",
"buttons1": "\ue0e0 选择文件 \ue0e3 全选 \ue0ef 安装选中文件 \ue0e1 取消"
},
"sd": {
"help": {
"title": "帮助",
"desc": "复制 NSP、NSZ、XCI 或 XCZ 文件到 SD 卡,\n定位并选中想要安装的文件,然后按 \ue0ef 键。"
},
"top_info": "选择想要安装的文件,然后按 \ue0ef 安装!",
"source_string": " (来源: SD 卡)",
"delete_info": " 安装完成!是否将原文件从 SD 卡中删除?",
"delete_info_multi": " 个文件安装成功!是否将原文件从 SD 卡中删除?",
"delete_desc": "安装完成后已不需要原文件。",
"buttons": "\ue0e0 选择文件 \ue0e3 全选 \ue0ef 安装选中文件 \ue0e2 帮助 \ue0e1 取消"
},
"hdd": {
"source_string": " (来源: USB 硬盘)"
},
"usb": {
"help": {
"title": "帮助",
"desc": "可以通过 USB 从其他设备使用某些工具安装文件,如 NS-USBloader (Tinfoil 模式)。\n要向 Switch 发送文件,打开电脑或者移动设备上任一工具软件,\n输入屏幕上显示的 Switch IP 地址,选择文件,然后上传到您的主机。\n若您使用的工具软件不支持选择特定文件类型,您可以尝试更改为可接受的文件扩展名。\nTinleaf Installer 在通过网络安装时不限定文件扩展名。\n\n如果实在搞不懂,请复制文件到 SD 卡并尝试在主菜单中选择“通过 SD 卡安装”。"
},
"top_info": "USB 连接成功!正等待接收文件列表...",
"top_info2": "选择将要通过 USB 安装的文件,然后按 \ue0ef 键。",
"error": "USB 传输超时或失败",
"source_string": " (来源: USB)",
"buttons": "\ue0e2 (按住) 帮助 \ue0e1 (按住) 取消",
"buttons2": "\ue0e0 选择文件 \ue0e3 全选 \ue0ef 安装选中文件 \ue0e1 取消"
},
"target": {
"desc0": "请选择 ",
"desc1": " 的安装位置",
"desc00": "请选择已选 ",
"desc01": " 个文件的安装位置?",
"opt0": "SD 卡",
"opt1": "内部存储"
},
"info_page": {
"top_info0": "正在安装 ",
"preparing": "正在准备安装...",
"failed": "安装失败: ",
"failed_desc": "不完全安装的内容可从系统设置中删除。",
"complete": "安装完成",
"desc0": " 个文件安装成功!",
"desc1": " 已安装!",
"downloading": "正在下载 ",
"at": " , 速度 "
},
"nca_verify": {
"title": "检测到无效 NCA 签名!",
"desc": "请确认非正规签名的文件来源可靠。\n包含从卡带转换以及 DLC 解锁器的文件将始终显示此警告。\n您可以在 Tinleaf Installer 设置中禁用此项检查。\n\n是否继续安装?",
"opt1": "是的,我已明白其中风险",
"error": "请求安装的 NCA 没有正规签名:"
},
"finished": [
"享受您的“合法备份”吧!",
"我相信您在试玩游戏后,将更有兴趣购买它!",
"您买游戏了吧?老任感谢您的购买!",
"绕开 DRM 真是太爽啦。",
"您拒绝购买游戏的行为大概保护了6棵大树免遭砍伐!还节省了塑料包装!",
"任天堂法务部已向您投递律师函,请注意查收。",
"八国语言无中文?英文亲切,乐享游戏!"
]
},
"sig": {
"install": "安装",
"uninstall": "卸载",
"update": "更新",
"version_text": "您已安装的签名补丁最高适用于此 HOS 版本:",
"title0": "安装签名补丁?",
"desc0": "安装和运行官方软件需要签名补丁。",
"backup_failed": "无法备份 Hekate 的 patches.ini!是否继续?",
"backup_failed_desc": "如果您不使用 Hekate,请忽略此警告。",
"download_failed": "无法下载签名补丁",
"download_failed_desc": "您可能在设置中设定了无效来源,\n或者服务器可能暂时无法访问。",
"version_text2": "您的签名补丁已更新至 HOS 最高适配版本 ",
"install_complete": "安装完成!",
"complete_desc": "重启主机以生效",
"restart": "立即重启",
"later": "稍后重启",
"extract_failed": "无法解压文件!",
"restore_failed": "无法恢复原始 Hekate 的 patch.ini!是否继续?",
"uninstall_complete": "卸载完成",
"remove_failed": "无法移除签名补丁",
"remove_failed_desc": "文件可能已被重命名或删除",
"generic_error": "安装签名补丁失败!"
},
"options": {
"menu_items": {
"ignore_firm": "忽略软件最低固件版本要求",
"nca_verify": "安装前验证 NCA 签名",
"boost_mode": "安装时启用\"加速模式\"",
"ask_delete": "安装后询问文件是否删除",
"auto_update": "自动检查 Tinleaf Installer 更新",
"sig_url": "签名补丁来源链接 (URL):",
"language": "语言:",
"check_update": "检查 Tinleaf Installer 更新",
"credits": "感谢名单"
},
"nca_warn": {
"title": "警告!",
"desc": "一些可安装文件可能包含恶意内容!\n只有在您确信安装文件绝对可靠的情况下\n才可以禁用此功能!\n\n是否仍然禁用 NCA 签名验证?",
"opt1": "是的,我不怕变砖"
},
"sig_hint": "输入签名补丁来源链接 (URL)",
"update": {
"title": "发现新版本",
"desc0": "Tinleaf Installer ",
"desc1": " 已经发布!是否更新?",
"opt0": "更新",
"top_info": "正在更新 Tinleaf Installer ",
"bot_info": "正在下载 Tinleaf Installer ",
"bot_info2": "正在解压 Tinleaf Installer ",
"complete": "更新完成!",
"failed": "更新失败!",
"end_desc": "此软件将关闭。",
"title_check_fail": "没有发现更新",
"desc_check_fail": "当前 Tinleaf Installer 已是最新版!"
},
"credits": {
"title": "感谢以下朋友!",
"desc": "- Adubbz"
},
"language": {
"title": "选择 Tinleaf Installer 语言",
"desc": "软件将在更改语言后关闭。按 \ue0e1 取消。",
"system_language": "系统默认"
},
"title": "更改 Tinleaf Installer 的设置!",
"buttons": "\ue0e0 选择/更改 \ue0e1 取消"
},
"common": {
"ok": "确定",
"cancel": "取消",
"close": "关闭",
"yes": "",
"no": "",
"cancel_desc": "\ue0e1 取消"
}
}
8 changes: 7 additions & 1 deletion source/ui/optionsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace inst::ui {
extern MainApplication *mainApp;

std::vector<std::string> languageStrings = {"English", "日本語", "Français", "Deutsch", "Italiano", "Русский"};
std::vector<std::string> languageStrings = {"English", "日本語", "Français", "Deutsch", "Italiano", "Русский", "簡体中文"};

optionsPage::optionsPage() : Layout::Layout() {
this->SetBackgroundColor(COLOR("#343E87FF"));
Expand Down Expand Up @@ -90,6 +90,9 @@ namespace inst::ui {
return languageStrings[4];
case 10:
return languageStrings[5];
case 6:
case 15:
return languageStrings[6];
default:
return "options.language.system_language"_lang;
}
Expand Down Expand Up @@ -200,6 +203,9 @@ namespace inst::ui {
case 5:
inst::config::languageSetting = 10;
break;
case 6:
inst::config::languageSetting = 15;
break;
default:
inst::config::languageSetting = 99;
}
Expand Down
13 changes: 10 additions & 3 deletions source/util/lang.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <iostream>
#include <switch.h>
#include <filesystem>
#include <pu/Plutonium>
#include "util/lang.hpp"
#include "util/config.hpp"

Expand Down Expand Up @@ -36,10 +37,13 @@ namespace Language {
break;
case 5:
case 14:
languagePath = "romfs:/lang/es.json";
languagePath = "romfs:/lang/es-419.json";
break;
case 6:
languagePath = "romfs:/lang/zh-CN.json";
case 15:
languagePath = "romfs:/lang/zh-Hans.json";
// the default font will miss some chinese character, so use a chinese font (simplified)
pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseSimplified);
break;
case 7:
languagePath = "romfs:/lang/ko.json";
Expand All @@ -54,7 +58,10 @@ namespace Language {
languagePath = "romfs:/lang/ru.json";
break;
case 11:
languagePath = "romfs:/lang/zh-TW.json";
case 16:
languagePath = "romfs:/lang/zh-Hant.json";
// the default font will miss some chinese character, so use a chinese font (traditional)
pu::ui::render::SetDefaultFontFromShared(pu::ui::render::SharedFont::ChineseTraditional);
break;
default:
languagePath = "romfs:/lang/en.json";
Expand Down

0 comments on commit 485671d

Please sign in to comment.