Skip to content

Commit

Permalink
Merge pull request #1002 from okfn/995-add-lang-menu
Browse files Browse the repository at this point in the history
Add language chooser
  • Loading branch information
pdelboca authored Nov 8, 2023
2 parents ee7986e + ab53951 commit 12b8cb4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
12 changes: 1 addition & 11 deletions templates/general.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,7 @@
</div>
</form>
</li>
<!-- <li class="main-nav__item -language" data-current-language="English">
<label class="icon">
<span></span>
</label>
<ul class="submenu -simple">
<li><a href="">English</a></li>
<li><a href="">Español</a></li>
<li><a href="">Português (Brasil)</a></li>
<li><a href="">Français</a></li>
</ul>
</li> -->
{% language_chooser %}
</ul>
</li>
</ul>
Expand Down
18 changes: 18 additions & 0 deletions templates/menu/language_chooser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% load i18n menu_tags static %}

{% if languages|length > 1 %}
<li class="main-nav__item -has-submenu has-children">
<label>
<img src="{% static '/img/icons/header-globe.svg' %}" class="max-w-none" alt="Language">
</label>
<ul class="submenu">
{# We filter Portuguese until all translations are finished. #}
{% for language in languages %}
{% if language.0 != "pt" %}
<li class="lang{% if current_language == language.0 %} active{% endif %}">
<a href="{% page_language_url language.0 %}" title="{% trans " Change to language:" %} {{ language.1 }}">{{language.1 }}</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}

0 comments on commit 12b8cb4

Please sign in to comment.