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

add Simplified/Traditional Chinese language swich #991

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ sidebar:
#links:
#Title: http://example.com/

# Simplified/Traditional Chinese language swich
language_switch:
enable: true
# swith_to default setting is Traditional, it means that the website default language simplified
switch_to: 繁體

# ---------------------------------------------------------------
# Misc Theme Settings
Expand Down
16 changes: 16 additions & 0 deletions layout/_partials/footer.swig
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@
NexT.{{ theme.scheme }}
</a>
</div>

{% if theme.language_switch.enable %}
<div class="language-switch">
<a id="translateLink" href="javascript:translatePage();">{{ theme.language_switch.switch_to }}</a>
<script type="text/javascript" src="{{config.url}}/js/src/tw_cn.js"></script>
<script type="text/javascript">
var defaultEncoding = 2; //网站编写字体是否繁体,1-繁体,2-简体
var translateDelay = 0; //延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
var cookieDomain = "{{config.url}}/"; //Cookie地址, 一定要设定, 通常为你的网址
var msgToTraditionalChinese = "繁體"; //此处可以更改为你想要显示的文字
var msgToSimplifiedChinese = "简体"; //同上,但两处均不建议更改
var translateButtonId = "translateLink"; //默认互换id
translateInitilization();
</script>
</div>
{% endif %}
11 changes: 11 additions & 0 deletions source/css/_common/components/footer/footer.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
}
}

.language-switch { display: inline-block; }

.theme-info {
margin-right: 10px;

&::after {
content: "|";
padding-left: 10px;
}
}

.cc-license {
margin-top: 10px;
text-align: center;
Expand Down
Loading