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

refactor:i18n #334

Merged
merged 8 commits into from
May 10, 2023
Merged

refactor:i18n #334

merged 8 commits into from
May 10, 2023

Conversation

Wolfsin
Copy link
Contributor

@Wolfsin Wolfsin commented Apr 6, 2023

按照 #297 (comment) 的建议, 我调整了i18n的结构和一些字段。
目前我只调整了简体中文的json文件,如果该结构可以被采纳,请给我留言,我会对英语和繁体中文做同样的调整。

@Bin-Huang
Copy link
Owner

好的,我有空的时候看一下

@Wolfsin
Copy link
Contributor Author

Wolfsin commented May 4, 2023

好的,我有空的时候看一下

你好,我注意到有越来越多的开发者开始提交不同语言的翻译,我觉得对于该PR的处理可能需要加快速度。
另外最近的几次更新,在原来的i18n json文件中加入了新的文本内容,此PR可能需要进行一些更新,我希望你能给我一点反馈,让我知道是否有必要在这个PR的工作上继续下去。

src/i18n/locales/zh-Hans/translation.json Outdated Show resolved Hide resolved
src/SettingWindow.tsx Show resolved Hide resolved
@Bin-Huang
Copy link
Owner

@Wolfsin 很抱歉我才发现我没有提交 review,其实我很早就评论了但忘记提交了……

@Wolfsin
Copy link
Contributor Author

Wolfsin commented May 7, 2023

@Bin-Huang 谢谢你的review,对于文本中使用了标签,我在conversation中提交了自己的看法和官方文档的补充说明。
我想听听你的想法来确定是否使用这个feature
但愿这次不会太久(笑~)

@Bin-Huang
Copy link
Owner

好的,我先阅读下文档

@Wolfsin
Copy link
Contributor Author

Wolfsin commented May 7, 2023

@Bin-Huang 我刚刚提交了更新,重构了最新branches的新文本
因为a标签不在白名单内,所以我使用了另一种方法来结合文本和html标签。

refactor:i18n
@Bin-Huang
Copy link
Owner

整体上我特别喜欢现在这种新做法,感觉容易维护很多。看上去现在应该只需要迁移其他语言的 i18n 就可以了。如果你准备好合并了可以告诉我,我已经很期待最后的合并了。

对了我最近有个思考中的问题,想听听你的看法:现在每个语言对应一个文件,还有一种做法是把所有语言放在同一个文件,并采用类似下面的格式

{
    "submit": {
        "cn": "发送",
        "en": "Submit"
    }
}

我感觉第二种做法似乎看上去更容易开发和维护,但不确定有没有什么其他潜在的问题。想听听你的看法~

@Wolfsin
Copy link
Contributor Author

Wolfsin commented May 8, 2023

@Bin-Huang 我很高兴对于i8n的重构终于进入尾声,我已经将修改同步至了其他语言,并进行了简单的UI测试。如果我没有漏掉些什么的话,该PR已经做好了Merge准备。


对了我最近有个思考中的问题,想听听你的看法:现在每个语言对应一个文件,还有一种做法是把所有语言放在同一个文件,并采用类似下面的格式

我认为,如果你打算自己维护所有的翻译文本的话,那么同一文件的做法的确会让开发和维护相对容易一些,但是对于想参与翻译文本的开发者来说,同一文件的做法会大大增加merge conflicts的可能性,并且随着文本和支持语言的增加,文件会变得非常庞大,反而不利于工作

@Bin-Huang
Copy link
Owner

嗯嗯,我觉得你的看法是对的。真的是很棒的PR,特别感谢你对开源社区的贡献!

@Bin-Huang Bin-Huang merged commit a9778a2 into Bin-Huang:main May 10, 2023
@Wolfsin Wolfsin deleted the i18n branch July 10, 2023 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants