Github页面上的多种语言
很长一段时间我没有访问我的页面,所以,昨天我检查了翻译对键盘页面不起作用,github页面上有更新吗 存储库结构:github.com/andeon/askey/tree/gh-pagesGithub页面上的多种语言,github,jekyll,github-pages,Github,Jekyll,Github Pages,很长一段时间我没有访问我的页面,所以,昨天我检查了翻译对键盘页面不起作用,github页面上有更新吗 存储库结构:github.com/andeon/askey/tree/gh-pages - |-- _includes/ # Html rendered - |-- _layouts/ # Templates of the website - |-- dic/ # keyboards translation - |-- index.html
- |-- _includes/ # Html rendered
- |-- _layouts/ # Templates of the website
- |-- dic/ # keyboards translation
- |-- index.html # Default html file (EN)
- |-- pt # Portuguese Language files
- |-- (...)
- |-- _config.yml # Jekyll configuration file
文件“\u includes/gimp\u keyboard.html”使用变量page.t[page.lang]($variable)链接“dic/gimp\u en.md”或“dic/gimp\u pt.md”等中的翻译,这就是翻译按键和弹出窗口的工具提示的原因
Gimp_en.yml的结构:
layout: main_gimp
t:
en:
tooltip_esc: "Close Dialogs"
tooltip_f1: "Help"
例如:gimp_keyboard.html Esc键工具提示:
{{site.t.l_thc[page.lang]}
{{page.t[page.lang].key_w}
*_config.yml中绑定的变量“site.t.(…)[page.lang]”的全局翻译正在工作
我不知道如何修理它。也许用“字典文件”的技巧来制作多种语言不是一种明智的方法(但这里我需要变量来创建一种更简单的翻译方法)
有没有人有任何想法来修复或提出其他建议
我使用这个网站作为创建页面的参考:benoitpatra.com/2014/08/24/organize-a-multi-language-jekyll-site/是的,这是github现在使用的jekyll2.x和jekyll3.x之间的变化 您的语言字符串位于布局中。例如:gimp.html具有dic/gimp_en布局,它本身在
t
键下的前面有语言字符串
使用jekyll2.x,布局变量通过页面中的模板级联传递。您通过page.t
现在使用jekyll3.x,在布局变量中传递模板变量。您可以使用layout.t
如果将所有出现的page.t
替换为layout.t
,神奇的事情就会再次发生
旁注:您可以将所有语言字符串集中在数据文件中。\u data/lang/en/gimp.yml中的英文字符串和\u data/lang/pt/gimp.yml中的葡萄牙语,并通过site.lang[page.lang]
访问它们
然后,您可以移除中间层dic/gimp_xx布局
这将是未来的证明