-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from gaphor/language-dropdown
Move language selection to dropdown menu
- Loading branch information
Showing
15 changed files
with
94 additions
and
22 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
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,10 @@ | ||
{ | ||
"en": "English", | ||
"es": "Español", | ||
"cs": "Čeština", | ||
"nl": "Nederlands", | ||
"hr": "Hrvatski", | ||
"hu": "Magyar", | ||
"ru": "Русский", | ||
"tr": "Türkçe" | ||
} |
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
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,7 +1,20 @@ | ||
<nav class="col-12 d-flex justify-content-end language-navigation"> | ||
<ul> | ||
{% for item in site.data.languages.languages %} | ||
<li><a {% static_href %}href="{{ site.baseurl | append: item.url | append: page.url }}"{% endstatic_href %}>{{ item.title }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<form action="{{ site.baseurl }}{{ page.url }}" method="get"> | ||
|
||
<select id="language-chooser-select" name="lang" autocomplete="off"> | ||
{% for lang in site.languages %} | ||
<option value="{{ lang }}" {% if lang== site.active_lang %}selected="selected" {% endif %}> | ||
{{ site.data.languagenames[lang] }} | ||
</option> | ||
{% endfor %} | ||
</select> | ||
|
||
<script src="/js/languages.js" async></script> | ||
|
||
<noscript> | ||
<input id="language-chooser-submit" type="submit" value="{{ site.data.strings.languages.change }}"/> | ||
</noscript> | ||
|
||
</form> | ||
</nav> |
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 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,19 @@ | ||
|
||
const chooser = document.getElementById('language-chooser-select'); | ||
let activeLang = 'en'; | ||
for (let i = 0; i < chooser.children.length; i++) { | ||
if (chooser.children[i].selected) { | ||
activeLang = chooser.children[i].value; | ||
} | ||
} | ||
|
||
chooser.onchange = function() { | ||
const lang = this.value; | ||
let pageUrl = document.location.pathname; | ||
|
||
if (new RegExp('^/' + activeLang + '/').test(pageUrl)) { | ||
pageUrl = pageUrl.substring(activeLang.length + 1); | ||
} | ||
|
||
document.location = '' + '/' + lang + pageUrl; | ||
} |
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 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 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 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 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 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 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 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