fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.49k stars 274 forks source link

如何修改中文? #381

Closed hyy34 closed 9 months ago

hyy34 commented 10 months ago

修改_config.yml language: zh-CN但是好多还是英文?例如左上角的标签页,文章的Next Post Previous Post还有上方的share,如何彻底修改成中文呢?

hyy34 commented 9 months ago

Hello?

Stark-X commented 9 months ago

你可以参考 https://github.com/fi3ework/hexo-theme-archer/blob/4559f799b020a14a9c7a08066536243b3d337414/layout/post.ejs#L10 同时,修改 languages/default.yml 以及 languages/en.yml 添加相对应的中英文,即可。

hyy34 commented 9 months ago

你可以参考

https://github.com/fi3ework/hexo-theme-archer/blob/4559f799b020a14a9c7a08066536243b3d337414/layout/post.ejs#L10

同时,修改 languages/default.yml 以及 languages/en.yml 添加相对应的中英文,即可。

修改yml文件对应的中英文看明白了,但是修改这个ejs文件的第10行没看懂呢?给个简易的教程被。 比如说这些个地方 1CV5XDbWd9 rm2SOriRXM zAxMfz4JMq JNwQuFcDE0

hyy34 commented 9 months ago

修改了,主题文件夹里的各种ejs文件,应该都改过来了。。

但是有个问题,如果配置文件里(copyright:)改为true了,那么日期如何变为中文显示?

Stark-X commented 9 months ago

Invalid date 跟配置中英文没关系,是解析的日期不规范导致的,例如如果日期为none等情况

Catalog 在这里,类似的情况,请善用 github 的搜索 / grep / findtext / ide里的全文搜索 等,查看代码。 https://github.com/fi3ework/hexo-theme-archer/blob/4559f799b020a14a9c7a08066536243b3d337414/layout/layout.ejs#L42

可以参考我之前的回复的位置,添加翻译模板,再重新构建就可以了。

你可以参考

https://github.com/fi3ework/hexo-theme-archer/blob/4559f799b020a14a9c7a08066536243b3d337414/layout/post.ejs#L10

同时,修改 languages/default.yml 以及 languages/en.yml 添加相对应的中英文,即可。

hyy34 commented 9 months ago

日期修改找到了方法, 修改hexo目录下node_modules/moment/min/moment-with-locales.js最后一行,把en改成zh-cn 修改/themes/archer/layout/post.ejs里,MMMM Do YYYY, h:mm:ss a 改为 YYYY年M月D日。 具体其他修改格式可参照moment-with-locales.js 文件中代码 hooks.defineLocale('zh-cn',(17837行)下的例子。