adding language subtags to template and support for right-to-left locales
parent
daf843df07
commit
52803e2d70
|
@ -7,6 +7,7 @@ not yet released
|
||||||
|
|
||||||
* #161: Added Swedish translation.
|
* #161: Added Swedish translation.
|
||||||
* #210: Added Finnish translation.
|
* #210: Added Finnish translation.
|
||||||
|
* #201: Added Persian translation.
|
||||||
* #195: Updated Spanish translation.
|
* #195: Updated Spanish translation.
|
||||||
* #169: Increased server ip char limit to 500.
|
* #169: Increased server ip char limit to 500.
|
||||||
* #164: Added support for FreeVoipDeal SMS gateway <http://www.freevoipdeal.com>.
|
* #164: Added support for FreeVoipDeal SMS gateway <http://www.freevoipdeal.com>.
|
||||||
|
|
|
@ -111,6 +111,10 @@ The following people have contributed to the translation of PHP Server Monitor:
|
||||||
|
|
||||||
* Ik-Jun
|
* Ik-Jun
|
||||||
|
|
||||||
|
* Persian
|
||||||
|
|
||||||
|
* Javad Evazzadeh Kakroudi - https://github.com/evazzadeh
|
||||||
|
|
||||||
* Polish
|
* Polish
|
||||||
|
|
||||||
* Arkadiusz Klenczar - https://github.com/aklenczar
|
* Arkadiusz Klenczar - https://github.com/aklenczar
|
||||||
|
|
|
@ -25,6 +25,10 @@ Each language file should contain a 'locale' key which can be used for formattin
|
||||||
|
|
||||||
For more information, see http://www.php.net/manual/en/function.setlocale.php
|
For more information, see http://www.php.net/manual/en/function.setlocale.php
|
||||||
|
|
||||||
|
For display purposes, the language file should also provide the text direction (ltr / rtl) and language subtag.
|
||||||
|
Unfortunately they do not match 1:1 with the locales used for the server.
|
||||||
|
Valid language subtags can be found on http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry.
|
||||||
|
|
||||||
Adding a new language
|
Adding a new language
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Български - Bulgarian',
|
'name' => 'Български - Bulgarian',
|
||||||
'locale' => array('bg_BG.UTF-8', 'bg_BG', 'bulgarian'),
|
'locale' => array('bg_BG.UTF-8', 'bg_BG', 'bulgarian'),
|
||||||
|
'locale_tag' => 'bg',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Мониторинг',
|
'title' => 'Мониторинг',
|
||||||
'install' => 'Инсталация',
|
'install' => 'Инсталация',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Česky - Czech',
|
'name' => 'Česky - Czech',
|
||||||
'locale' => array('cs_CZ.UTF-8', 'cs_CZ', 'czech', 'czech'),
|
'locale' => array('cs_CZ.UTF-8', 'cs_CZ', 'czech', 'czech'),
|
||||||
|
'locale_tag' => 'cs',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Instalace',
|
'install' => 'Instalace',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Dansk - Danish',
|
'name' => 'Dansk - Danish',
|
||||||
'locale' => array('da_DK.UTF-8', 'da_DK', 'danish', 'danish-dk'),
|
'locale' => array('da_DK.UTF-8', 'da_DK', 'danish', 'danish-dk'),
|
||||||
|
'locale_tag' => 'da',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Installere',
|
'install' => 'Installere',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Deutsch - German',
|
'name' => 'Deutsch - German',
|
||||||
'locale' => array('de_DE.UTF-8', 'de_DE', 'german'),
|
'locale' => array('de_DE.UTF-8', 'de_DE', 'german'),
|
||||||
|
'locale_tag' => 'de',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Installation',
|
'install' => 'Installation',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'English',
|
'name' => 'English',
|
||||||
'locale' => array('en_US.UTF-8', 'en_US', 'american', 'english-us'),
|
'locale' => array('en_US.UTF-8', 'en_US', 'american', 'english-us'),
|
||||||
|
'locale_tag' => 'en',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Install',
|
'install' => 'Install',
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Español - Spanish',
|
'name' => 'Español - Spanish',
|
||||||
'locale' => array('es_ES.UTF-8', 'es_ES', 'spanish', 'esp'),
|
'locale' => array('es_ES.UTF-8', 'es_ES', 'spanish', 'esp'),
|
||||||
|
'locale_tag' => 'es',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Instalar',
|
'install' => 'Instalar',
|
||||||
|
|
|
@ -18,16 +18,18 @@
|
||||||
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
|
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* @package phpservermon
|
* @package phpservermon
|
||||||
* @author Pepijn Over <pep@neanderthal-technology.com>
|
* @author Javad Evazzadeh Kakroudi
|
||||||
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
|
* @copyright Copyright (c) 2008-2015 Pepijn Over <pep@peplab.net>
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
|
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
|
||||||
* @version Release: v3.1.1
|
* @version Release: @package_version@
|
||||||
* @link http://www.phpservermonitor.org/
|
* @link http://www.phpservermonitor.org/
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'فارسی - Persian',
|
'name' => 'فارسی - Persian',
|
||||||
'locale' => array('fa_IR.UTF-8', 'fa_IR', 'far', 'per', 'fa', 'lang'=>'fa_IR', 'dir'=>'rtl'),
|
'locale' => array('fa_IR.UTF-8', 'fa_IR', 'far', 'per', 'fa'),
|
||||||
|
'locale_tag' => 'fa',
|
||||||
|
'locale_dir' => 'rtl',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'مانیتورینگ سرور',
|
'title' => 'مانیتورینگ سرور',
|
||||||
'install' => 'نصب',
|
'install' => 'نصب',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Suomi - Finnish',
|
'name' => 'Suomi - Finnish',
|
||||||
'locale' => array('fi_FI.UTF-8', 'fi_FI', 'finnish', 'finnish-fi'),
|
'locale' => array('fi_FI.UTF-8', 'fi_FI', 'finnish', 'finnish-fi'),
|
||||||
|
'locale_tag' => 'fi',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Asenna',
|
'install' => 'Asenna',
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Français - French',
|
'name' => 'Français - French',
|
||||||
'locale' => array('fr_FR.UTF-8', 'fr_FR', 'french'),
|
'locale' => array('fr_FR.UTF-8', 'fr_FR', 'french'),
|
||||||
|
'locale_tag' => 'fr',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Installer',
|
'install' => 'Installer',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Italiano - Italian',
|
'name' => 'Italiano - Italian',
|
||||||
'locale' => array('it_IT.UTF-8', 'it_IT', 'italian', 'ita'),
|
'locale' => array('it_IT.UTF-8', 'it_IT', 'italian', 'ita'),
|
||||||
|
'locale_tag' => 'it',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Install',
|
'install' => 'Install',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => '한국 - Korean',
|
'name' => '한국 - Korean',
|
||||||
'locale' => array('ko_KR.UTF-8', 'ko_KR', 'korean'),
|
'locale' => array('ko_KR.UTF-8', 'ko_KR', 'korean'),
|
||||||
|
'locale_tag' => 'ko',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Install',
|
'install' => 'Install',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Nederlands - Dutch',
|
'name' => 'Nederlands - Dutch',
|
||||||
'locale' => array('nl_NL.UTF-8', 'nl_NL', 'dutch'),
|
'locale' => array('nl_NL.UTF-8', 'nl_NL', 'dutch'),
|
||||||
|
'locale_tag' => 'nl',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Installeren',
|
'install' => 'Installeren',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Polski - Polish',
|
'name' => 'Polski - Polish',
|
||||||
'locale' => array('pl_PL.UTF-8', 'pl_PL', 'polski', 'polski'),
|
'locale' => array('pl_PL.UTF-8', 'pl_PL', 'polski', 'polski'),
|
||||||
|
'locale_tag' => 'pl',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Instalacja',
|
'install' => 'Instalacja',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Português - Brazilian Portuguese',
|
'name' => 'Português - Brazilian Portuguese',
|
||||||
'locale' => array('pt_BR.UTF-8', 'pt_BR', 'portuguese-brazilian'),
|
'locale' => array('pt_BR.UTF-8', 'pt_BR', 'portuguese-brazilian'),
|
||||||
|
'locale_tag' => 'BR',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Instalar',
|
'install' => 'Instalar',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Russian - Русский',
|
'name' => 'Russian - Русский',
|
||||||
'locale' => array('ru_RU.UTF-8', 'ru_RU', 'russian', 'russian'),
|
'locale' => array('ru_RU.UTF-8', 'ru_RU', 'russian', 'russian'),
|
||||||
|
'locale_tag' => 'ru',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Сервер Мониторинг',
|
'title' => 'Сервер Мониторинг',
|
||||||
'install' => 'Установка',
|
'install' => 'Установка',
|
||||||
|
|
|
@ -21,13 +21,15 @@
|
||||||
* @author andlil
|
* @author andlil
|
||||||
* @copyright Copyright (c) 2008-2015 Pepijn Over <pep@peplab.net>
|
* @copyright Copyright (c) 2008-2015 Pepijn Over <pep@peplab.net>
|
||||||
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
|
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
|
||||||
* @version Release: v3.1.1
|
* @version Release: @package_version@
|
||||||
* @link http://www.phpservermonitor.org/
|
* @link http://www.phpservermonitor.org/
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Svenska - Swedish',
|
'name' => 'Svenska - Swedish',
|
||||||
'locale' => array('sv_SE.UTF-8', 'sv_SE', 'svenska', 'svenska-SE'),
|
'locale' => array('sv_SE.UTF-8', 'sv_SE', 'svenska', 'svenska-SE'),
|
||||||
|
'locale_tag' => 'sv',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Installera',
|
'install' => 'Installera',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => 'Türkçe - Turkish',
|
'name' => 'Türkçe - Turkish',
|
||||||
'locale' => array('tr_TR.UTF-8', 'tr_TR', 'turkish', 'turkish-tr'),
|
'locale' => array('tr_TR.UTF-8', 'tr_TR', 'turkish', 'turkish-tr'),
|
||||||
|
'locale_tag' => 'tr',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => 'Yükle',
|
'install' => 'Yükle',
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
$sm_lang = array(
|
$sm_lang = array(
|
||||||
'name' => '中文 - Chinese',
|
'name' => '中文 - Chinese',
|
||||||
'locale' => array('zh_CN.UTF-8', 'zh_CN', 'chinese', 'chinese-cn'),
|
'locale' => array('zh_CN.UTF-8', 'zh_CN', 'chinese', 'chinese-cn'),
|
||||||
|
'locale_tag' => 'zh',
|
||||||
|
'locale_dir' => 'ltr',
|
||||||
'system' => array(
|
'system' => array(
|
||||||
'title' => 'Server Monitor',
|
'title' => 'Server Monitor',
|
||||||
'install' => '安装',
|
'install' => '安装',
|
||||||
|
|
|
@ -52,7 +52,6 @@ class Router {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->container = $this->buildServiceContainer();
|
$this->container = $this->buildServiceContainer();
|
||||||
$this->buildTwigEnvironment();
|
|
||||||
|
|
||||||
$mods = $this->container->getParameter('modules');
|
$mods = $this->container->getParameter('modules');
|
||||||
|
|
||||||
|
@ -79,6 +78,7 @@ class Router {
|
||||||
} else {
|
} else {
|
||||||
$controller = $mod;
|
$controller = $mod;
|
||||||
}
|
}
|
||||||
|
$this->buildTwigEnvironment();
|
||||||
|
|
||||||
$controller = $this->getController($mod, $controller);
|
$controller = $this->getController($mod, $controller);
|
||||||
$action = null;
|
$action = null;
|
||||||
|
@ -228,6 +228,9 @@ class Router {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$twig->addGlobal('direction_current', psm_get_lang('locale_dir'));
|
||||||
|
$twig->addGlobal('language_current', psm_get_lang('locale_tag'));
|
||||||
|
|
||||||
return $twig;
|
return $twig;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="{{ language_current }}" dir="{{ direction_current }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
|
|
Loading…
Reference in New Issue