Skip to content

Commit

Permalink
Add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
UnniKohonen committed Aug 31, 2023
1 parent edb2e8e commit 6198c8a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/view/sidebar.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
<div class="bg-light" id="sidebar">
{% block sidebar %}
<div class="sidebar-buttons">
<h2 class="visually-hidden">Sidebar listing: list and traverse vocabulary contents by a criterion</h2> {# Should be changed for translation #}
<h2 class="visually-hidden">{{'Sidebar listing: list and traverse vocabulary contents by a criterion' | trans}}</h2>

<ul class="nav nav-tabs-no-style nav-justified" id="sidebar-tabs" role="tablist">
{% for view in vocab.config.sidebarViews %}
<h3 class="visually-hidden">{{ view }}</h3> {# Should be changed for translation #}
{% if view == 'alphabetical' %} {% set view_trans_text = ['Alpha-nav', 'List vocabulary concepts alphabetically'] %}
{% elseif view == 'hierarchy' %} {% set view_trans_text = ['Hier-nav', 'List vocabulary concepts hierarchically'] %}
{% elseif view == 'groups' %} {% set view_trans_text = ['Group-nav', 'List vocabulary concepts and groupings hierarchically'] %}
{% else %} {% set view_trans_text = vocab.config.showDeprecatedChanges ? ['Changes-and-deprecations-nav', 'List vocabulary concepts by newest additions including removed'] : ['Changes-nav', 'List vocabulary concepts by newest additions'] %}{% endif %}
<h3 class="visually-hidden">{{ view_trans_text[1] | trans }}</h3>
{# active_class is used to set initial active tab and disabled_class is used to disable hierarchy tab #}
{# On vocab page active tab is set to defaultSidebarView, on concept page active tab is set to defaultConceptSidebarView #}
{% set active_class = (request.page == 'vocab' and view == vocab.config.defaultSidebarView) or (request.page == 'page' and view == vocab.config.defaultConceptSidebarView) %}
{# Hierarchy tab is disabled on vocab page if showTopConcepts is set to false #}
{% set disabled_class = request.page == 'vocab' and view == 'hierarchy' and not (vocab.config.showTopConcepts) %}
<li id="{{ view }}" class="nav-item">
<a class="nav-link{% if active_class %} active{% elseif disabled_class %} disabled{% endif %}" role="tab" data-bs-toggle="tab" href="#tab-{{ view }}" aria-controls="tab-{{ view }}">
{{ view }} {# Should be changed for translation #}
<a class="nav-link{% if active_class %} active{% elseif disabled_class %} disabled{% endif %}"
{% if disabled_class %}data-title="{{ 'hierarchy-disabled-help' | trans }}"{% endif %}
role="tab" data-bs-toggle="tab" href="#tab-{{ view }}" aria-controls="tab-{{ view }}">
{{ view_trans_text[0] | trans }}
</a>
</li>
{% endfor %}
Expand All @@ -27,7 +33,7 @@
{# active_class is used to set initial active tab #}
{# On vocab page active tab is set to defaultSidebarView, on concept page active tab is set to defaultConceptSidebarView #}
{% set active_class = (request.page == 'vocab' and view == vocab.config.defaultSidebarView) or (request.page == 'page' and view == vocab.config.defaultConceptSidebarView) %}
<div class="tab-pane{% if active_class %} active {% endif %}" id="tab-{{ view }}" role="tabpanel">
<div class="tab-pane{% if active_class %} active{% endif %}" id="tab-{{ view }}" role="tabpanel">
{{ view }} {# should be removed #}
</div>
{% endfor %}
Expand Down

0 comments on commit 6198c8a

Please sign in to comment.