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

引入 i18n 机制和代码结构 #66

Merged
merged 1 commit into from
Oct 18, 2018
Merged

引入 i18n 机制和代码结构 #66

merged 1 commit into from
Oct 18, 2018

Conversation

harttle
Copy link
Member

@harttle harttle commented Oct 17, 2018

主题和文章的翻译机制大概都通了,每种场景都给了示例。语言选择入口还没加,请直接访问多语言 URL 参与翻译。使用方法如下:

翻译主题文件

在语言文件(themes/san/languages/{en, zh-cn}.yml )中定义变量,在主题文件(themes/san/layout/*.ejs)中引用,如有需要在 source 下建立多语言入口。已有示例如下:

注意多 /en/ 页面下资源的相对 URL 会变,请使用绝对 URL 解决

翻译文章文件

source/_post/en/ 中添加对应的翻译文件,直接访问对应的多语言 URL 即可预览。已有示例如下:

示例也可以参考上述 PR 中的 diff。

@harttle harttle requested a review from errorrik October 17, 2018 17:20
@errorrik errorrik merged commit 8ab5de9 into master Oct 18, 2018

### data

`Explanation`:

Choose a reason for hiding this comment

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

中文冒号替换一下

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! 现在只是跑通结构和示例改动。这篇文档 @andycall 来翻译,会整个替换。

Copy link
Member

Choose a reason for hiding this comment

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

好,我后面注意一下

@harttle harttle changed the title 英文翻译 引入 i18n 机制和代码结构 Oct 25, 2018
@andycall andycall mentioned this pull request Oct 25, 2018
54 tasks
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

4 participants