fisrt commit'

This commit is contained in:
2018-05-24 18:51:55 +02:00
commit 906f96a15e
3463 changed files with 425820 additions and 0 deletions
@@ -0,0 +1,6 @@
# v1.0.0
## 07/22/2017
1. [](#new)
* ChangeLog started...
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Clemdesign (http://www.clemdesign.fr)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+111
View File
@@ -0,0 +1,111 @@
# Grav Language Selector Plugin
![Language Selector](assets/readme_1.jpg)
`Language Selector` is a [Grav](http://github.com/getgrav/grav) plugin that provides native language selector with flags to switch between [Multiple Languages](http://learn.getgrav.org/content/multi-language).
# Installation
Installing the Language Selector plugin can be done only manually for this moment. GPM installation is not yet available
## Manual Installation (Download)
To install this plugin, just download the zip version of this repository and unzip it under `user/plugins`. Then, rename the folder to `language-selector`. You can find these files either on [GitHub](https://github.com/clemdesign/grav-plugin-language-selector).
You should now have all the plugin files under
/yoursite/user/plugins/language-selector
## Manual Installation (Using GIT)
In `user/plugins` folder, apply the following command:
```
git clone https://github.com/clemdesign/grav-plugin-language-selector language-selector
```
This will clone this repository into the _language-selector_ folder.
# Usage
The `Language Selector` plugin doesn't require any configuration. You do however need to add the included Twig partials template into your own theme somewhere you want the available languages to be displayed.
```
{% include 'partials/language-selector.html.twig' %}
```
Something you might want to do is to override the look and feel of the langswitcher, and with Grav it is super easy.
Copy the template file [language-selector.html.twig](templates/partials/language-selector.html.twig) into the `templates` folder of your custom theme:
```
/yoursite/user/themes/custom-theme/templates/partials/language-selector.html.twig
```
You can now edit the override and tweak it however you prefer.
## Usage of the `hreflang` partial
A second template is available for `hreflang` annotations in the header of the page. In order to emit language annotations for the available languages of a page you need to add the corrsponding Twig partial template into the `<head>` section of your page, which can typically be found in `base.html.twig`:
```
{% include 'partials/language-selector.hreflang.html.twig' %}
```
This will generate something like:
```
<link rel="alternate" href="http://example.com/en" hreflang="en" />
<link rel="alternate" href="http://example.com/fr" hreflang="fr" />
<link rel="alternate" href="http://example.com/zh-cn" hreflang="zh-cn" />
```
# Configuration
## Plugin
Simply copy the `user/plugins/language-selector/language-selector.yaml` into `user/config/plugins/language-selector.yaml` and make your modifications.
```
enabled: true
built_in_css: true
button_display: default
select_display: default
```
Options `enabled` and `built_in_css` are pretty self explanatory.
For `button_display`, this one define how button of selected language will be displayed. There are 3 possibilities:
- `default`: Flag and Language name are displayed
- `flag`: Only flag is displayed
- `name`: Only language name is displayed
For `select_display`, this one define how language selector will be displayed. There are 3 possibilities:
- `default`: Flag and Language name are displayed
- `flag`: Only flag is displayed
- `name`: Only language name is displayed
## Redirecting after switching language
To have Grav redirect to the default page route after switching language, you must add the following configuration to `user/config/system.yaml`
```
pages:
redirect_default_route: true
```
# Contribute
# Languages
For Administration panel, `Language Selector` is available in English and French. You could contribute for another languages.
For flags and language names, it is available for both match between flag images (content in `language-selector/flags`) and the list of language name in `Grav/Common/Language/LanguageCodes.php`.
You could contribute by adding new flags to match with list of language name, or the opposite.
Flag images are sized 24 x 12 pixels in PNG.
# Credits
[Language Selector](https://github.com/clemdesign/grav-plugin-language-selector) is based on [Lang Switcher](https://github.com/getgrav/grav-plugin-langswitcher) plugin.
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -0,0 +1,68 @@
name: Language Selector
version: 1.0.0
description: Language Selector is a [Grav](http://github.com/getgrav/grav) plugin that provides native language selector with flags to switch between [multiple languages](http://learn.getgrav.org/content/multi-language).
icon: globe
author:
name: Clément G.
email: contact@clemdesign.fr
url: http://www.clemdesign.fr
homepage: https://github.com/clemdesign/grav-plugin-language-selector
keywords: mulitlang, multilanguage, translation, switcher, selector, flag
bugs: https://github.com/clemdesign/grav-plugin-language-selector/issues
docs: https://github.com/clemdesign/grav-plugin-language-selector/blob/master/README.md
license: MIT
form:
validation: strict
fields:
enabled:
type: toggle
label: PLUGINS.LANGUAGE_SELECTOR.PLUGIN_STATUS
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
built_in_css:
type: toggle
label: PLUGINS.LANGUAGE_SELECTOR.BUILT_IN_CSS
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
untranslated_pages_behavior:
type: select
label: PLUGINS.LANGUAGE_SELECTOR.UNTRANSLATED_PAGES.LABEL
help: PLUGINS.LANGUAGE_SELECTOR.UNTRANSLATED_PAGES.HELP
default: none
options:
none: PLUGINS.LANGUAGE_SELECTOR.UNTRANSLATED_PAGES.OPT_NONE
redirect: PLUGINS.LANGUAGE_SELECTOR.UNTRANSLATED_PAGES.OPT_REDIR
hide: PLUGINS.LANGUAGE_SELECTOR.UNTRANSLATED_PAGES.OPT_HIDE
button_display:
type: select
label: PLUGINS.LANGUAGE_SELECTOR.BUTTON_DISPLAY.LABEL
help: PLUGINS.LANGUAGE_SELECTOR.BUTTON_DISPLAY.HELP
default: default
options:
default: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_DEFAULT
flag: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_FLAG
name: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_NAME
select_display:
type: select
label: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.LABEL
help: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.HELP
default: default
options:
default: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_DEFAULT
flag: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_FLAG
name: PLUGINS.LANGUAGE_SELECTOR.SELECT_DISPLAY.OPT_NAME
@@ -0,0 +1,87 @@
.language-selector {
float: right;
position: relative;
top: 50%;
vertical-align: middle;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
margin: 0 1rem !important;
display: inline-block;
}
.language-selector>.btn:first-child {
margin-left: 0;
}
.language-selector .btn {
float: left;
position: relative;
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
user-select: none;
background-image: none;
border: 1px solid transparent;
/* size */
padding: 5px 10px;
font-size: 0.8rem;
line-height: 1.5;
border-radius: 3px;
/* Aspect */
color: #333;
background-color: #fff;
border-color: #ccc;
}
.language-selector .dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
padding: 5px 0;
margin: 2px 0 0;
font-size: 1rem;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.language-selector .dropdown-menu img {
width: 24px;
height: 12px;
max-width: inherit;
}
.language-selector .dropdown-menu li {
line-height: 1rem;
font-color: #c0c0c0;
display: list-item;
text-align: -webkit-match-parent;
}
.language-selector .dropdown-menu li:hover {
background-color: #eee;
}
.language-selector .dropdown-menu>li>a {
display: block;
padding: 3px 15px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

@@ -0,0 +1,89 @@
/*!
* Language Selector JS plugin
* Copyright 2017 Clement G., Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
var dropdownmenu={
animspeed: 200, //reveal animation speed (in milliseconds)
showhidedelay: [150, 150], //delay before menu appears and disappears when mouse rolls over it, in milliseconds
//***** NO NEED TO EDIT BEYOND HERE
builtdropdownids: [], //ids of dropdown already built (to prevent repeated building of same dropdown)
stubboxenable: false,
showbox:function($, $dropdown){
this.stubboxenable = false
clearTimeout($dropdown.data('timers').hidetimer)
$dropdown.data('timers').showtimer=setTimeout(function(){$dropdown.show(dropdownmenu.animspeed)}, this.showhidedelay[0])
},
hidebox:function($, $dropdown){
if(this.stubboxenable == false) {
clearTimeout($dropdown.data('timers').showtimer)
$dropdown.data('timers').hidetimer=setTimeout(function(){$dropdown.hide(100)}, this.showhidedelay[1]) //hide dropdown plus all of its sub ULs
}
},
stubbox:function($, $dropdown){
this.stubboxenable = true
clearTimeout($dropdown.data('timers').hidetimer)
$dropdown.data('timers').showtimer=setTimeout(function(){$dropdown.show(dropdownmenu.animspeed)}, this.showhidedelay[0])
},
builddropdown:function($, $menu, $target){
$menu.css({display:'none'}).addClass('jqdropdown')
$menu.bind('mouseenter', function(){
clearTimeout($menu.data('timers').hidetimer)
})
$menu.bind('mouseleave', function(){ //hide menu when mouse moves out of it
dropdownmenu.hidebox($, $menu)
})
$menu.data('dimensions', {w:$menu.outerWidth(), h:$menu.outerHeight()}) //remember main menu's dimensions
$menu.data('timers', {})
this.builtdropdownids.push($menu.get(0).id) //remember id of dropdown that was just built
},
init:function($, $target, $dropdown){
if (this.builtdropdownids.length==0){ //only bind click event to document once
$(document).bind("click", function(e){
if (e.button==0){ //hide all dropdown (and their sub ULs) when left mouse button is clicked
$('.jqdropdown').find('ul').andSelf().hide()
}
})
}
if (jQuery.inArray($dropdown.get(0).id, this.builtdropdownids)==-1) //if this dropdown hasn't been built yet
this.builddropdown($, $dropdown, $target)
if ($target.parents().filter('ul.jqdropdown').length>0) //if $target matches an element within the dropdown markup, don't bind ondropdown to that element
return
$target.bind("mouseenter", function(e){
dropdownmenu.showbox($, $dropdown)
})
$target.bind("mouseleave", function(e){
dropdownmenu.hidebox($, $dropdown)
})
$target.bind("click", function(e){
dropdownmenu.stubbox($, $dropdown)
})
}
};
jQuery.fn.adddropdown=function(dropdownid){
var $=jQuery
return this.each(function(){ //return jQuery obj
var $target=$(this)
if ($('#'+dropdownid).length==1) //check dropdown is defined
dropdownmenu.init($, $target, $('#'+dropdownid))
})
};
//By default, add dropdown to anchor links with attribute "data-dropdown"
jQuery(document).ready(function($){
var $anchors=$('*[data-dropdown]')
$anchors.each(function(){
$(this).adddropdown(this.getAttribute('data-dropdown'))
})
});
@@ -0,0 +1,109 @@
<?php
namespace Grav\Plugin;
use Grav\Common\Language\LanguageCodes;
use Grav\Common\Page\Page;
use \Grav\Common\Plugin;
class LanguageSelectorPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPluginsInitialized' => ['onPluginsInitialized', 0]
];
}
/**
* Initialize configuration
*/
public function onPluginsInitialized()
{
if ($this->isAdmin()) {
$this->active = false;
return;
}
$this->enable([
'onTwigInitialized' => ['onTwigInitialized', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
/** Add the native_name function */
public function onTwigInitialized()
{
$this->grav['twig']->twig()->addFunction(
new \Twig_SimpleFunction('native_name', function($key) {
return LanguageCodes::getNativeName($key);
})
);
}
/**
* Add current directory to twig lookup paths.
*/
public function onTwigTemplatePaths()
{
$this->grav['twig']->twig_paths[] = __DIR__ . '/templates';
}
/**
* Set needed variables to display Language-Selector.
*/
public function onTwigSiteVariables()
{
$data = new \stdClass;
// Manage Data content
$page = $this->grav['page'];
$data->page_route = $page->rawRoute();
if ($page->home()) {
$data->page_route = '/';
}
$languages = $this->grav['language']->getLanguages();
$data->languages = $languages;
if ($this->config->get('plugins.language-selector.untranslated_pages_behavior') !== 'none') {
$translated_pages = [];
foreach ($languages as $language) {
$translated_pages[$language] = null;
$page_name_without_ext = substr($page->name(), 0, -(strlen($page->extension())));
$translated_page_path = $page->path() . DS . $page_name_without_ext . '.' . $language . '.md';
if (file_exists($translated_page_path)) {
$translated_page = new Page();
$translated_page->init(new \SplFileInfo($translated_page_path), $language . '.md');
$translated_pages[$language] = $translated_page;
}
}
$data->translated_pages = $translated_pages;
}
$data->current = $this->grav['language']->getLanguage();
// Manage Twig Variables
$path_flags = $this->grav['locator']->findResource('plugin://language-selector/flags/', false) . "/";
$path_flags = $this->grav['base_url'] ."/". ltrim($path_flags, '/');
$this->grav['twig']->twig_vars['language_selector'] = $data;
$this->grav['twig']->twig_vars['language_display'] = array(
"select" => $this->config->get('plugins.language-selector.select_display'),
"button" => $this->config->get('plugins.language-selector.button_display'),
);
$this->grav['twig']->twig_vars['path_flags'] = $path_flags;
// Manage Assets
$this->grav['assets']->add('plugin://language-selector/js/language-selector.js');
if ($this->config->get('plugins.language-selector.built_in_css')) {
$this->grav['assets']->add('plugin://language-selector/css/language-selector.css');
}
}
public function getNativeName($code) {
}
}
@@ -0,0 +1,5 @@
enabled: true
built_in_css: true
untranslated_pages_behavior: none
button_display: default
select_display: default
@@ -0,0 +1,43 @@
# English
en:
PLUGINS:
LANGUAGE_SELECTOR:
PLUGIN_STATUS: 'Plugin status'
BUILT_IN_CSS: 'Use built in CSS'
UNTRANSLATED_PAGES:
LABEL: 'Untranslated pages behavior'
HELP: 'Determine what to do with a language link when the current page doesn''t exist in that language or it exists but it''s not published.'
OPT_NONE: 'Show language (default)'
OPT_REDIR: 'Show language, link to home route'
OPT_HIDE: 'Hide language'
BUTTON_DISPLAY:
LABEL: 'Button Display'
HELP: 'Define how button of selected language will be displayed'
SELECT_DISPLAY:
LABEL: 'Selector Display'
HELP: 'Define how language selector will be displayed'
OPT_DEFAULT: 'Flag + Language name'
OPT_FLAG: 'Only the flag'
OPT_NAME: 'Only the language name'
# French
fr:
PLUGINS:
LANGUAGE_SELECTOR:
PLUGIN_STATUS: 'Statut du plugin'
BUILT_IN_CSS: 'Utiliser CSS du plugin'
UNTRANSLATED_PAGES:
LABEL: 'Comportement des pages non-traduites'
HELP: 'Définit le comportement des liens lorsque la page n''existe pas dans la langue courante, ou bien existe mais non publié'
OPT_NONE: 'Affiche le langage (par défaut)'
OPT_REDIR: 'Affiche le langage, lié à l''URL de base'
OPT_HIDE: 'Cache le langage'
BUTTON_DISPLAY:
LABEL: 'Affichage du boutton'
HELP: 'Définit l''affichage du bouton de language sélectioné'
SELECT_DISPLAY:
LABEL: 'Affichage du sélecteur'
HELP: 'Définit l''affichage du sélecteur de language'
OPT_DEFAULT: 'Drapeau + Nom de la langue'
OPT_FLAG: 'Seulement le drapeau'
OPT_NAME: 'Seulement le nom de la langue'
@@ -0,0 +1,9 @@
{% set langobj = grav['language'] %}
{% for key in language_selector.languages %}
{% if key == language_selector.current %}
{% set lang_url = page.url %}
{% else %}
{% set lang_url = base_url_simple ~ langobj.getLanguageURLPrefix(key) ~ language_selector.page_route ~ page.urlExtension ?: '/' %}
{% endif %}
<link rel="alternate" hreflang="{{ key }}" href="{{ lang_url ~ uri.params }}" />
{% endfor %}
@@ -0,0 +1,49 @@
<div class="language-selector">
<button class="btn" type="button" data-dropdown="langSelectorList">
{% if language_display.button == 'default' or language_display.button == 'flag' %}
<img alt="{{ native_name(language_selector.current)|capitalize }}" src="{{ path_flags ~ language_selector.current }}.png" />
{% endif %}
{% if language_display.button == 'default' or language_display.button == 'name' %}
{{ native_name(language_selector.current)|capitalize }}
{% endif %}
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu" id="langSelectorList">
{% for language in language_selector.languages %}
{% set show_language = true %}
{% if language == language_selector.current %}
{% set lang_url = page.url %}
{% else %}
{% set base_lang_url = base_url_simple ~ grav.language.getLanguageURLPrefix(language) %}
{% set lang_url = base_lang_url ~ language_selector.page_route ~ page.urlExtension %}
{% set untranslated_pages_behavior = grav.config.plugins.language_selector.untranslated_pages_behavior %}
{% if untranslated_pages_behavior != 'none' %}
{% set translated_page = language_selector.translated_pages[language] %}
{% if (not translated_page) or (not translated_page.published) %}
{% if untranslated_pages_behavior == 'redirect' %}
{% set lang_url = base_lang_url ~ '/' %}
{% elseif untranslated_pages_behavior == 'hide' %}
{% set show_language = false %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if show_language %}
<li>
<a href="{{ lang_url ~ uri.params }}">
{% if language_display.select == 'default' or language_display.select == 'flag' %}
<img alt="{{ native_name(language)|capitalize }}" src="{{ path_flags ~ language }}.png" />
{% endif %}
{% if language_display.select == 'default' or language_display.select == 'name' %}
{{ native_name(language)|capitalize }}
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</div>