Improve README.md and language-selector.php

This commit is contained in:
Clement G 2017-07-22 16:15:38 +02:00
parent 0c0f11370c
commit 19301c7bb3
2 changed files with 17 additions and 4 deletions

View File

@ -8,7 +8,7 @@
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 only manually for this moment. GPM installation is not yet available
## Manual Installation ## 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). 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).
@ -16,7 +16,10 @@ You should now have all the plugin files under
/yoursite/user/plugins/language-selector /yoursite/user/plugins/language-selector
Other way is to use `GIT`. In `user/plugins` folder, apply the following command:
## Manual Installation (Using GIT)
In `user/plugins` folder, apply the following command:
``` ```
git clone https://github.com/clemdesign/grav-plugin-language-selector language-selector git clone https://github.com/clemdesign/grav-plugin-language-selector language-selector
``` ```
@ -70,7 +73,17 @@ button_display: default
select_display: default select_display: default
``` ```
Options are pretty self explanatory. 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 Llnguage 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 Llnguage name is displayed
## Redirecting after switching language ## Redirecting after switching language

View File

@ -97,10 +97,10 @@ class LanguageSelectorPlugin extends Plugin
$this->grav['twig']->twig_vars['path_flags'] = $path_flags; $this->grav['twig']->twig_vars['path_flags'] = $path_flags;
// Manage Assets // Manage Assets
$this->grav['assets']->add('plugin://language-selector/js/language-selector.js');
if ($this->config->get('plugins.language-selector.built_in_css')) { if ($this->config->get('plugins.language-selector.built_in_css')) {
$this->grav['assets']->add('plugin://language-selector/css/language-selector.css'); $this->grav['assets']->add('plugin://language-selector/css/language-selector.css');
} }
$this->grav['assets']->add('plugin://language-selector/js/language-selector.js');
} }
public function getNativeName($code) { public function getNativeName($code) {