generated from loonghao/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update documentation for multi-language support and language sw…
…itcher Signed-off-by: longhao <hal.long@outlook.com>
- Loading branch information
Showing
12 changed files
with
1,272 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% for section, _ in sections.items() %} | ||
{% if section %}### {{ section }} | ||
|
||
{% endif %} | ||
{% if sections[section] %} | ||
{% for category, val in definitions.items() if category in sections[section] %} | ||
|
||
#### {{ definitions[category]['name'] }} | ||
|
||
{% for text, values in sections[section][category].items() %} | ||
* {{ text }} {{ values|join(', ') }} | ||
{% endfor %} | ||
{% endfor %} | ||
{% else %} | ||
No significant changes. | ||
|
||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
{%- if language %} | ||
<button class="language-switcher" id="language-switcher" title="{{ _('Switch Language') }}"> | ||
{%- if language == "zh_CN" %} | ||
<a href="{{ pathto('../' + (pagename[6:] if pagename.startswith('zh_CN/') else pagename), 1) }}" style="color: inherit; text-decoration: none;"> | ||
<span>EN</span> | ||
</a> | ||
{%- else %} | ||
<a href="{{ pathto('zh_CN/' + pagename, 1) }}" style="color: inherit; text-decoration: none;"> | ||
<span>中</span> | ||
</a> | ||
{%- endif %} | ||
</button> | ||
<div class="language-switcher"> | ||
<div class="language-switcher__label"> | ||
{% if language == 'en_US' %}Language{% else %}语言{% endif %} | ||
</div> | ||
<div class="language-switcher__options"> | ||
<span class="language-switcher__current">{{ supported_languages[language]["name"] }}</span> | ||
{% for alt_lang in alternate_languages %} | ||
<a href="{{ pathto(alt_lang.url_prefix + '/' + (pagename[6:] if pagename.startswith(language + '/') else pagename), 1) }}" | ||
class="language-switcher__option"> | ||
{{ alt_lang.name }} | ||
</a> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{%- endif %} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends "!layout.html" %} | ||
|
||
{% block scripts %} | ||
{{ super() }} | ||
<script> | ||
function switchLanguage(lang) { | ||
var currentPath = window.location.pathname; | ||
var newPath = currentPath.replace(/\/(en_US|zh_CN)\//, '/' + lang + '/'); | ||
window.location.href = newPath; | ||
} | ||
</script> | ||
{% endblock %} | ||
|
||
{% block document %} | ||
<div class="language-switcher"> | ||
{% if language == 'en_US' %}Language:{% else %}语言:{% endif %} | ||
<span class="current-lang">{{ supported_languages[language]["name"] }}</span> | ||
{% for lang, info in supported_languages.items() %} | ||
{% if lang != language %} | ||
| <a href="javascript:switchLanguage('{{ lang }}')" class="lang-link">{{ info.name }}</a> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{{ super() }} | ||
{% endblock %} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.