-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: i18n #22
Comments
已上傳的圖像: 這種在 jekyll 框架上部屬到 github page 靜態網站中的中間有插入圖片的文字段落,如何用 i18n 或是其他工具支援翻譯功能? ChatGPT: 要在Jekyll框架上部署的GitHub Pages静态网站中实现翻译功能(如插入图片的文字段落),你可以使用Jekyll的i18n插件或者其他方法来支持多语言。以下是使用i18n插件的步骤:
gems:
- jekyll-multiple-languages-plugin
languages:
- en
- zh
default_lang: en
copyright:
notice: "I, %{author}, DO NOT own the copyrights of all resources on this website, especially images and data. This website is a combination of the gold efficiency calculation formula from %{league_wiki} with the design elements from %{wr_meta} featuring manually updated item data from %{wild_rift}."
copyright:
notice: "我,%{author},不擁有此網站上所有資源的版權,特別是圖片和數據。此網站是基於%{league_wiki}的金效率計算公式與%{wr_meta}的設計元素結合,並手動更新%{wild_rift}的數據。"
<div class="copyright">
<p>{{ site.data.locales[site.active_lang].copyright.notice | default: site.data.locales[site.default_lang].copyright.notice }}</p>
</div>
<div class="copyright">
<p>{{ site.data.locales[site.active_lang].copyright.notice | replace: '%{author}', '<img src="https://github.com/favicon.ico" alt="changchiiyou">' | replace: '%{league_wiki}', '<img src="path_to_league_of_legend_wiki_image" alt="League of Legend Wiki">' | replace: '%{wr_meta}', '<img src="path_to_wr_meta_image" alt="WR META">' | replace: '%{wild_rift}', '<img src="path_to_wild_rift_image" alt="Wild Rift">' }}</p>
</div>
<nav>
<ul>
<li><a href="{{ site.baseurl }}/en">English</a></li>
<li><a href="{{ site.baseurl }}/zh">中文</a></li>
</ul>
</nav> 并在每个页面的头部添加语言前缀,例如: ---
layout: default
lang: en
--- 通过以上步骤,你可以在Jekyll框架上为GitHub Pages静态网站添加翻译功能,支持带有图片和变量的文本段落。这样,用户可以通过切换语言来查看网站的不同语言版本。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: