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

feat: add language picker #1695

Open
wants to merge 1 commit into
base: gh-pages
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
34 changes: 34 additions & 0 deletions _data/languages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- code: en
name: English
- code: fr
name: Français
- code: de
name: Deutsch
- code: es
name: Español
- code: it
name: Italiano
- code: ja
name: 日本語
- code: ru
name: Русский
- code: zh-cn
name: 中文 (简体)
- code: zh-tw
name: 繁體中文
- code: ko
name: 한국어
- code: pt-br
name: Português
- code: sk
name: Slovenčina
- code: uk
name: Українська
- code: uz
name: Oʻzbekcha
- code: tr
name: Türkçe
- code: th
name: ภาษาไทย
- code: id
name: Indonesia
9 changes: 6 additions & 3 deletions _includes/header/header-de.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
23 changes: 13 additions & 10 deletions _includes/header/header-en.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,23 @@
<a href="{{site.posts.first.url}}"{% if page.menu == 'blog' %} class="active"{% endif %}>Blog</a>
<ul class="submenu-content">
<li>
<a href="{{site.posts.first.url}}">Latest post</a>
<a href="{{site.posts.first.url}}">Latest post</a>
</li>
<li>
<a href="/{{ page.lang }}/blog/posts.html">All posts</a>
</li>
<a href="/{{ page.lang }}/blog/posts.html">All posts</a>
</li>
<li>
<a href="/{{ page.lang }}/blog/write-post.html">Write a Post</a>
</li>
</ul>
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
</li>
</ul>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
11 changes: 7 additions & 4 deletions _includes/header/header-es.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-fr.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
</div>
{% include language-picker.html %}
</div>
</header>
4 changes: 3 additions & 1 deletion _includes/header/header-id.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@
</li>
</ul>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>

9 changes: 6 additions & 3 deletions _includes/header/header-it.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
11 changes: 7 additions & 4 deletions _includes/header/header-ja.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
11 changes: 7 additions & 4 deletions _includes/header/header-ko.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-pt-br.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-ru.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
7 changes: 5 additions & 2 deletions _includes/header/header-sk.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-th.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-tr.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-uk.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
15 changes: 9 additions & 6 deletions _includes/header/header-uz.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ul class="submenu-content">
<li>
<a href="/{{ page.lang }}/starter/installing.html">
O'rnatish
O'rnatish
</a>
</li>
<li>
Expand All @@ -23,7 +23,7 @@
</li>
<li>
<a href="/{{ page.lang }}/starter/generator.html">
Express generator
Express generator
</a>
</li>
<li>
Expand Down Expand Up @@ -92,7 +92,7 @@
</li>
<li><a href="/{{ page.lang }}/advanced/best-practice-performance.html">Performance best practices</a>
</li>
</ul>
</ul>
</li>
<li id="resources-menu" class="submenu">
<a href="/{{ page.lang }}/resources/glossary.html"{% if page.menu == 'resources' %} class="active"{% endif %}>Resources</a>
Expand All @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-zh-cn.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
9 changes: 6 additions & 3 deletions _includes/header/header-zh-tw.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@
</li>
</ul>
</div>
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
<div class="header-right">
<div id="theme-icon-container" class="theme-toggle default-theme" title="toggle darkmode">
<i class="fa fa-moon-o fa-2x hidden-dark"></i>
<span class="sun-icon hidden-light"></span>
</div>
{% include language-picker.html %}
</div>
</header>
28 changes: 28 additions & 0 deletions _includes/language-picker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div id="navbar">
<ul id="navmenu">
{% assign url_parts = page.url | split: '/' %}

{% assign url_remainder = url_parts | slice: 2, url_parts.size | join: '/' %}

<li class="submenu">
<div id="current-lang" class="current-lang"></div>
<div id="languageData"
data-languages='{{ site.data.languages | jsonify }}'
style="display:none;">
</div>
<ul class="submenu-content">
{% for lang in site.data.languages %}
<li>
<a href="/{{ lang.code }}/{{ url_remainder }}">
{% if lang.code | to_s == current_lang | to_s %}
<strong>{{ lang.name }}</strong>
{% else %}
{{ lang.name }}
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
</div>
Loading