modif comtabilite
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
|
||||
# v1.1.0
|
||||
## 11/23/2018
|
||||
|
||||
1. [](#improved)
|
||||
* Add pull-request [#7](https://github.com/clemdesign/grav-plugin-language-selector/pull/7): Need jQuery 1.8 or later.
|
||||
|
||||
|
||||
# v1.0.1
|
||||
## 08/10/2018
|
||||
|
||||
1. [](#improved)
|
||||
* Add pull-request [#1](https://github.com/clemdesign/grav-plugin-language-selector/pull/1)
|
||||
|
||||
2. [](#bugfix)
|
||||
* Fix issue [#2](https://github.com/clemdesign/grav-plugin-language-selector/issues/2)
|
||||
-> Improve jQuery integration
|
||||
|
||||
# v1.0.0
|
||||
## 07/22/2017
|
||||
|
||||
|
||||
@@ -6,7 +6,15 @@
|
||||
|
||||
# Installation
|
||||
|
||||
Installing the Language Selector plugin can be done only manually for this moment. GPM installation is not yet available
|
||||
Installing the Language Selector plugin can be done in one of two ways. GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file or GIT.
|
||||
|
||||
## GPM Installation (Preferred)
|
||||
|
||||
The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
|
||||
|
||||
bin/gpm install language-selector
|
||||
|
||||
This will install the Language Selector plugin into your `/user/plugins` directory within Grav. Its files can be found under `/yoursite/user/plugins/language-selector`.
|
||||
|
||||
## Manual Installation (Download)
|
||||
|
||||
@@ -28,7 +36,20 @@ 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.
|
||||
## 1. Define the supported languages
|
||||
|
||||
In `system.yaml`, add the supported languages in `languages.supported` parameter.
|
||||
|
||||
Example:
|
||||
|
||||
languages:
|
||||
supported:
|
||||
- fr
|
||||
- en
|
||||
|
||||
## 2. Integration
|
||||
|
||||
You do 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' %}
|
||||
@@ -44,7 +65,9 @@ Copy the template file [language-selector.html.twig](templates/partials/language
|
||||
|
||||
You can now edit the override and tweak it however you prefer.
|
||||
|
||||
## Usage of the `hreflang` partial
|
||||
`language-selector` need jQuery (1.8 -> later) to display dropdown language menu.
|
||||
|
||||
## 3. 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`:
|
||||
|
||||
@@ -95,7 +118,7 @@ pages:
|
||||
|
||||
# Contribute
|
||||
|
||||
# Languages
|
||||
## Languages
|
||||
|
||||
For Administration panel, `Language Selector` is available in English and French. You could contribute for another languages.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: Language Selector
|
||||
version: 1.0.0
|
||||
version: 1.1.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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* Language Selector JS plugin
|
||||
* Copyright 2017 Clement G., Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* Licensed under MIT
|
||||
*/
|
||||
|
||||
var dropdownmenu={
|
||||
@@ -13,76 +13,78 @@ var dropdownmenu={
|
||||
stubboxenable: false,
|
||||
|
||||
showbox:function($, $dropdown){
|
||||
this.stubboxenable = false
|
||||
clearTimeout($dropdown.data('timers').hidetimer)
|
||||
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)
|
||||
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)
|
||||
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.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', {})
|
||||
});
|
||||
$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
|
||||
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 (e.button === 0){ //hide all dropdown (and their sub ULs) when left mouse button is clicked
|
||||
$('.jqdropdown').find('ul').addBack().hide()
|
||||
}
|
||||
})
|
||||
}
|
||||
if (jQuery.inArray($dropdown.get(0).id, this.builtdropdownids)==-1) //if this dropdown hasn't been built yet
|
||||
this.builddropdown($, $dropdown, $target)
|
||||
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
|
||||
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]')
|
||||
|
||||
jQuery.fn.adddropdown=function(dropdownid){
|
||||
var $=jQuery;
|
||||
return this.each(function(){ //return jQuery obj
|
||||
var $target=$(this);
|
||||
var $dropdownId = $('#'+dropdownid);
|
||||
if ($dropdownId.length === 1) //check dropdown is defined
|
||||
dropdownmenu.init($, $target, $dropdownId)
|
||||
})
|
||||
};
|
||||
|
||||
var $anchors=$('*[data-dropdown]');
|
||||
$anchors.each(function(){
|
||||
$(this).adddropdown(this.getAttribute('data-dropdown'))
|
||||
})
|
||||
|
||||
@@ -40,4 +40,48 @@ fr:
|
||||
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'
|
||||
OPT_NAME: 'Seulement le nom de la langue'
|
||||
|
||||
# Italian
|
||||
it:
|
||||
PLUGINS:
|
||||
LANGUAGE_SELECTOR:
|
||||
PLUGIN_STATUS: 'Status del plugin'
|
||||
BUILT_IN_CSS: 'Utilizzare CSS del plugin'
|
||||
UNTRANSLATED_PAGES:
|
||||
LABEL: 'Comportamento delle pagine non-tradotte'
|
||||
HELP: 'Determina il comportamento del link quando la pagina attuale non esiste in quella lingua, oppure esiste ma non è stata pubblicata.'
|
||||
OPT_NONE: 'Esibire lingua (default)'
|
||||
OPT_REDIR: 'Esibire lingua, linkare all''URL di base'
|
||||
OPT_HIDE: 'Nascondere lingua'
|
||||
BUTTON_DISPLAY:
|
||||
LABEL: 'Presentazione del tasto'
|
||||
HELP: 'Definisce la presentazione del tasto della lingua selezionata'
|
||||
SELECT_DISPLAY:
|
||||
LABEL: 'Presentazione del selettore'
|
||||
HELP: 'Definisce la presentazione del selettore di lingua'
|
||||
OPT_DEFAULT: 'Bandiera + Nome della lingua'
|
||||
OPT_FLAG: 'Soltanto la bandiera'
|
||||
OPT_NAME: 'Soltanto il nome della lingua'
|
||||
|
||||
# Portuguese (Brazil)
|
||||
pt-br:
|
||||
PLUGINS:
|
||||
LANGUAGE_SELECTOR:
|
||||
PLUGIN_STATUS: 'Status do plugin'
|
||||
BUILT_IN_CSS: 'Utilizar CSS do plugin'
|
||||
UNTRANSLATED_PAGES:
|
||||
LABEL: 'Comportamento das páginas não-traduzidas'
|
||||
HELP: 'Determina o comportamento do link quando a página atual não existe naquela língua, ou existe mas não está publicada.'
|
||||
OPT_NONE: 'Mostrar língua (default)'
|
||||
OPT_REDIR: 'Mostrar língua, linkar para o URL de base'
|
||||
OPT_HIDE: 'Esconder língua'
|
||||
BUTTON_DISPLAY:
|
||||
LABEL: 'Apresentação do botão'
|
||||
HELP: 'Define a apresentação do botão da língua selecionada'
|
||||
SELECT_DISPLAY:
|
||||
LABEL: 'Apresentação do seletor'
|
||||
HELP: 'Define a apresentação do seletor de língua'
|
||||
OPT_DEFAULT: 'Bandeira + Nome da língua'
|
||||
OPT_FLAG: 'Apenas a bandeira'
|
||||
OPT_NAME: 'Apenas o nome da língua'
|
||||
Reference in New Issue
Block a user