Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地化:语言、配置项、时间 #4145

Open
wants to merge 536 commits into
base: main
Choose a base branch
from

Conversation

tangge233
Copy link
Contributor

@tangge233 tangge233 commented Jul 2, 2024

开头

是的,我又来了
这是继 #119 之后再次挖坑(别再去那个 PR 评论了……)

语言文件 Key 值暂行命名方法

一般情况下遵循如下的命名规则

Lang +所属页面或 Mod 的名称+ HintDialog(Title/Content/Btn1/Btn2/…) (可选)+简易描述
例如 ModMinecraft.vb 中的“当前文件夹”对应的 Key 值为 LangModMinecraftCurrentFolder。这其中的 ModMinecraft 表面其属于 ModMinecraft.vb 这个 Mod,CurrentFolder 则描述其应当是当前目录的译文。

当然也有一些例外情况

比如 PCL 窗口最上方的按钮,对应极其明显,因此可以直接使用 LangTitleHome 作为主页(其实叫启动页)的 Key 值
又比如一些常使用的弹窗按钮,其 Key 值不需要表明所属的页面,可以有 LangDialogBtnOKLangDialogBtnCancel 等这样的写法。

总结

在表意明确的前提下做到最简表达

状况

正在做的事

  • 添加更多的语言(如果有人愿意帮忙的话……)
  • 优化一些语言的表达
  • 下载源切换(Others are doing this job.jpg)

还需要做的事

  • 优化一些 Key 值表达
  • 等待龙猫有意愿合并

已完成内容

  • 语言字段的提取
  • 时间的格式
  • 部分配置项的默认配置
  • Wiki 跳转部分支持
  • 解决模组整合包 Tag 组件的报错问题
  • 纠正一些变量、常量、枚举等单词拼写
  • README 文档添加英文选项
  • Issue 模板添加英文版本

不进行本地化的内容

  • 更新日志
  • 系统日志
  • 帮助库
  • 百宝箱
  • 大部分预设主页

帮助测试反馈

本地化工作可能会出现一些小错误,还请各位多多指正
开发版发布地址

帮助翻译 Help translation

Note

目前相关翻译人手不足,如果你是我们所正在支持的语言的母语者并且有一定的时间和精力,请务必考虑协助我们翻译。
At present, there is a shortage of relevant translators. If you are a native speaker of the language we are supporting and have some time and energy, please consider assisting us with translation.
在本 PR 未被合并之前,请使用 Weblate 帮助翻译
Before this PR is merged, you can always use Weblate to help us with translation.

目前支持语言(字母顺序排序) Languages Supported (Alphabetical)

  • 翻译状态 el_GR(Ελληνικά,Ελλάδα)
  • 翻译状态 en_GB(English,United Kingdom)
  • 翻译状态 en_US(English,US)
  • 翻译状态 es_ES(Español,España)
  • 翻译状态 fr_FR(Français,France)
  • 翻译状态 ja_JP(日本語,日本)
  • 翻译状态 ko_KR(한국어,대한민국)
  • 翻译状态 lzh(文言,華夏)
  • 翻译状态 ru_RU(Русский,Россия)
  • 翻译状态 sk_SK(Slovenčina)
  • 翻译状态 zh_CN(简体中文,中国大陆)
  • 翻译状态zh_HK(繁體中文,香港特別行政區)
  • 翻译状态 zh_MARS (焱暒妏)
  • 翻译状态 zh_MEME (梗体中文,天朝)
  • 翻译状态 zh_TW(繁體中文,台灣)

#4580 下留言请求添加新语言
If you want add more languages here, please leave your comment on #4580

本地化的相关调整

  • 离线登录以及第三方登录:非中国大陆地区在未登录正版账号的情况下只可以进行演示模式游玩,并且默认不会展示离线登录选项。
  • 启动器语言和游戏语言:启动器会根据用户的当前的地区自动选择合适的语言(如果没有预置语言文件则默认使用 en_US),游戏语言不再为自动调整为简体中文而是根据目前用户的启动器语言自动进行选择。
  • 下载源:启动器在中国大陆地区的下载源设置保持不变。在非中国大陆地区,版本列表获取源默认设定为 尽量使用官方源,Mod 信息获取默认设定为 尽量使用官方源
  • 帮助库和自定义主页预设:添加仅支持简体中文提示。
  • Mod 中文库:启动器语言不是简体中文时,不展示 Mod 中文名称,但是保留 MCMod 的跳转。
  • 部分控件代码调整

特别感谢

@3gf8jv4dv 帮助翻译 zh_HK、zh_TW、en_US 和 en_GB
@Chiloven945 帮助翻译 zh_HK、zh_TW、en_US、en_GB、el_GR,以及整 zh_MEME
@youzi-2333 正在帮忙翻译 lzh
@WForst-Breeze 正在帮忙翻译 fr_FR
@wuyuncheng-26 帮助增加翻译,以及整 zh_MEME
@SALTWOOD 帮忙整 zh_MEME
@WTP016-CN 帮助翻译 zh_HK

效果预览

6f97cb0ea7aeb099fd605ade72c7e1b5

9dd1f114c24a3f5bc0438cd25b599a46

86bb0b0b908be78ea4b0280f7a7768b5

331cb11d14dff4ddbeed4c4ccd13fb50

其它一些事

相关项目:Weblate

PCL2(压缩包)体积增量:0.8 MB 左右

Close #891

Image_255393843694655.jpg

@allMagicNB
Copy link
Contributor

allMagicNB commented Jul 2, 2024

哥们先转成草稿哥们(

@tangge233 tangge233 marked this pull request as draft July 2, 2024 15:01
@3gf8jv4dv
Copy link
Collaborator

Really appreciate this work. Keep following.

@allMagicNB
Copy link
Contributor

繁体中文不一定是 zh-HK,还有可能是 zh-TW zh-MO……

@3gf8jv4dv
Copy link
Collaborator

繁体中文不一定是 zh-HK,还有可能是 zh-TW zh-MO……

I am curious which one the author will choose.

Copy link
Collaborator

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some opinions.

Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
@Chiloven945
Copy link
Contributor

繁体中文不一定是 zh-HK,还有可能是 zh-TW zh-MO……

繁中可能需要拆分为zh-TW及zh-HK,按照Minecraft所提供的语言,香港及澳门共用zh-HK

Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
Plain Craft Launcher 2/Resources/Language/en_US.xaml Outdated Show resolved Hide resolved
@Deep-Dark-Forest Deep-Dark-Forest added · 新功能 等待确认 已经过社区确认,等待开发者确认 and removed 等待确认 已经过社区确认,等待开发者确认 labels Jul 3, 2024
@Deep-Dark-Forest
Copy link
Collaborator

建议在正文中添加:

Close #891

@tangge233

This comment was marked as resolved.

@tangge233

This comment was marked as resolved.

@JingHai-Lingyun
Copy link
Collaborator

我晚点看看,之前有尝试过做i18n

@allMagicNB
Copy link
Contributor

可以先调一遍存进变量再输出变量吗?(

@tangge233

This comment was marked as resolved.

@Chiloven945
Copy link
Contributor

实际上感觉对于字符串的翻译可以挪后,等之后有了crowdin project之后再进行翻译,翻译这件事情肯定是得社区投票之类的,目前可以先把代码内的文字改了就可以

@tangge233
Copy link
Contributor Author

实际上感觉对于字符串的翻译可以挪后,等之后有了crowdin project之后再进行翻译,翻译这件事情肯定是得社区投票之类的,目前可以先把代码内的文字改了就可以

是的,我也在想要不用 Weblate 这一类的项目提供更多语言翻译。目前先把多语言的可行性弄好……

@tangge233
Copy link
Contributor Author

后面写的代码基本上都没考虑多语言啊……写法十分………

@LTCatt
Copy link
Member

LTCatt commented Jul 4, 2024

最大问题就在于 PCL 的 UI 布局和代码都没有考虑过支持本地化……
因为英文比中文更长,PCL 的许多按钮或者布局在变成英文后都会显示不下,所以有的 UI 也需要调整,甚至怎么调整都放不下(

@tangge233
Copy link
Contributor Author

最大问题就在于 PCL 的 UI 布局和代码都没有考虑过支持本地化…… 因为英文比中文更长,PCL 的许多按钮或者布局在变成英文后都会显示不下,所以有的 UI 也需要调整,甚至怎么调整都放不下(

已经深刻体会过了(悲)

顺便问下 MyHint 控件的 Text 属性该如何改成支持使用动态资源

@JingHai-Lingyun
Copy link
Collaborator

最大问题就在于 PCL 的 UI 布局和代码都没有考虑过支持本地化

XAML(没有 Flex 动态布局)的痛…… 换完语言感觉还会要多出一堆数据值用来调整 UI……

@MCSteve123
Copy link

最大问题就在于 PCL 的 UI 布局和代码都没有考虑过支持本地化…… 因为英文比中文更长,PCL 的许多按钮或者布局在变成英文后都会显示不下,所以有的 UI 也需要调整,甚至怎么调整都放不下(

几年前的屎山(恼

@tangge233
Copy link
Contributor Author

image

刻进代码里的。一改就爆炸

@3gf8jv4dv
Copy link
Collaborator

3gf8jv4dv commented Jul 4, 2024

Some personal opinions.

For most of the basic translations, I think it would be best if we could reach a consensus in this PR. This also makes it easier to test the launcher UI.

For translation, we need to translate based on the UI situation and the actual language habits of the target users, instead of rigidly translating directly from Simplified Chinese. Some words do not need to be completely consistent with Simplified Chinese, as long as users can correctly understand their meaning. It is nice to see some implementation in the current commits, but it is far from enough.

For Traditional Chinese, considering that the current user audience and reviewers are almost all mainland users, you can put it aside for now and localize it with more professional tools later.

I think I will provide some opinions later, either as a review or a PR (against your branch), but there is no exact time yet.

@tangge233
Copy link
Contributor Author

Some personal opinions. 一些个人意见。

For most of the basic translations, I think it would be best if we could reach a consensus in this PR. This also makes it easier to test the launcher UI.对于大多数基本翻译,我认为如果我们能在这个 PR 中达成共识,那将是最好的。这也使测试启动器 UI 变得更加容易。

For translation, we need to translate based on the UI situation and the actual language habits of the target users, instead of rigidly translating directly from Simplified Chinese. Some words do not need to be completely consistent with simplified Chinese, as long as users can correctly understand their meaning. It is nice to see some implementation in the current commits, but it is far from enough.对于翻译,我们需要根据UI情况和目标用户的实际语言习惯进行翻译,而不是死板地直接从简体中文翻译。有些词不需要与简体中文完全一致,只要用户能正确理解其含义即可。很高兴在当前的提交中看到一些实现,但这还远远不够。

For Traditional Chinese, considering that the current user audience and reviewers are almost all mainland users, you can put it aside for now and localize it with more professional tools later.对于繁体中文,考虑到目前的用户受众和评论者几乎都是大陆用户,你可以暂时把它放在一边,以后用更专业的工具进行本地化。

I imagine I will provide some input later, either as a review or a PR (against your branch), but there is no exact time yet.我想我稍后会提供一些意见,无论是作为评论还是 PR(针对您的分支),但目前还没有确切的时间。

Thanks for your suggestions.For now,the most import part of this work is to let PCL has the ability to switch between multiple languages.So the language you see now wouldn't be the final version,it still needs the work of community to improve translations.
Thank you again for your continued attention to this work.

@JingHai-Lingyun
Copy link
Collaborator

Image 略

刻进代码里的。一改就爆炸

我有一个思路,此内容文本是在 VB 中实例化的,是否可以单独实现一个 ModI18N 以从 VB 操作层实现多语言?

@tangge233
Copy link
Contributor Author

我有一个思路,此内容文本是在 VB 中实例化的,是否可以单独实现一个 ModI18N 以从 VB 操作层实现多语言?

意思是在控件处修改展示文本?这样确实是可以

@tangge233
Copy link
Contributor Author

tangge233 commented Nov 9, 2024

自定义主页多语言适配草稿

Json 文件改动

增加 File 字段,当此字段不存在则直接使用对应文件名的 xaml 文件,此字段存在时的结构如下:

{
    "Version": "2",
    "__Author__": "作者",
    "Default": "zh_CN",
    "Data": {
        "zh_CN": {
            "Title": "标题内容",
            "Description": "页面介绍",
            "File": "默认地址"
        },
        "en_US": {
            "Title": "Title here",
            "Description": "Page description here",
            "File": "File address here"
        }
    }
}

自定义主页的主页面地址会尝试类似于 Custom.zh_CN.xamlCustom.en_US.xaml 这样的尝试

在此 PR 下方发表你的其它意见

点击下面的表情对此改动进行投票

@JingHai-Lingyun
Copy link
Collaborator

最终做的时候记得向前兼容

weblate and others added 21 commits November 16, 2024 15:26
Currently translated at 99.5% (1619 of 1627 strings)

Translated using Weblate (Greek)

Currently translated at 96.5% (1571 of 1627 strings)

Translated using Weblate (Korean)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (English (United Kingdom))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MARS))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (Slovak)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (Japanese)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (Chinese (Traditional Han script, Hong Kong))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (Spanish)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (Literary Chinese)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (French)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MEME))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (English (United States))

Currently translated at 96.9% (1577 of 1627 strings)

Translated using Weblate (English (United States))

Currently translated at 96.9% (1577 of 1627 strings)

Translated using Weblate (Russian)

Currently translated at 96.0% (1563 of 1627 strings)

Translated using Weblate (Greek)

Currently translated at 96.8% (1576 of 1627 strings)

Co-authored-by: Anonymous <noreply@weblate.org>
Co-authored-by: FAN585545 <fan09--@outlook.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: epickyhrac <ponozka12@outlook.com>
Co-authored-by: hejiehao <hejiehao12@126.com>
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/el/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/en_GB/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/en_US/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/es/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/fr/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ja/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ko/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/lzh/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ru/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/sk/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_Hant/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_Hant_HK/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MARS/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MEME/
Translation: PCL2/Launcher
Currently translated at 96.9% (1577 of 1627 strings)

Co-authored-by: wuyuncheng-26 <wuyuncheng26@qq.com>
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MEME/
Translation: PCL2/Launcher
Currently translated at 97.1% (1581 of 1627 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MEME))

Currently translated at 96.9% (1578 of 1627 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MEME))

Currently translated at 96.9% (1577 of 1627 strings)

Translated using Weblate (Literary Chinese)

Currently translated at 96.4% (1569 of 1627 strings)

Co-authored-by: 0120 <haochenxuan1022123@163.com>
Co-authored-by: MCSteve123 <minecraft3304@163.com>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: wuyuncheng-26 <wuyuncheng26@qq.com>
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/en_US/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/lzh/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MEME/
Translation: PCL2/Launcher
Currently translated at 94.0% (1542 of 1639 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MEME))

Currently translated at 94.8% (1554 of 1639 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MARS))

Currently translated at 94.8% (1555 of 1639 strings)

Translated using Weblate (English (United Kingdom))

Currently translated at 94.8% (1555 of 1639 strings)

Translated using Weblate (Chinese (Traditional Han script, Hong Kong))

Currently translated at 94.8% (1555 of 1639 strings)

Translated using Weblate (Spanish)

Currently translated at 94.0% (1542 of 1639 strings)

Translated using Weblate (French)

Currently translated at 94.0% (1542 of 1639 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 94.9% (1556 of 1639 strings)

Translated using Weblate (Russian)

Currently translated at 94.0% (1542 of 1639 strings)

Translated using Weblate (English (United States))

Currently translated at 95.1% (1559 of 1639 strings)

Translated using Weblate (Literary Chinese)

Currently translated at 94.4% (1548 of 1639 strings)

Translated using Weblate (Slovak)

Currently translated at 97.3% (1596 of 1639 strings)

Translated using Weblate (Greek)

Currently translated at 94.5% (1550 of 1639 strings)

Translated using Weblate (Korean)

Currently translated at 94.0% (1542 of 1639 strings)

Translated using Weblate (Chinese (Simplified Han script) (zh_MEME))

Currently translated at 96.8% (1576 of 1627 strings)

Translated using Weblate (Chinese (Traditional Han script))

Currently translated at 96.9% (1577 of 1627 strings)

Translated using Weblate (Literary Chinese)

Currently translated at 96.4% (1570 of 1627 strings)

Co-authored-by: Anonymous <noreply@weblate.org>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: yh liu <MCST930849070@outlook.com>
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/el/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/en_GB/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/en_US/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/es/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/fr/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ja/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ko/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/lzh/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/ru/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/sk/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_Hant/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_Hant_HK/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MARS/
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MEME/
Translation: PCL2/Launcher
Currently translated at 99.7% (1635 of 1639 strings)

Co-authored-by: tangge233 <tangge233@qq.com>
Translate-URL: http://weblate.tangge233.cn/projects/PCL/Launcher/zh_MEME/
Translation: PCL2/Launcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
· 新功能 暂无计划 短期内没有制作该项的计划
Projects
None yet
Development

Successfully merging this pull request may close these issues.

添加多语言支持(Add more languages)