Unify lang and locale config files

This commit is contained in:
Kijin Sung 2016-07-03 23:58:11 +09:00
parent 038a158dc7
commit 07d97242ec
7 changed files with 26 additions and 41 deletions

View file

@ -665,7 +665,8 @@ class Context
*/
public static function loadLangSupported()
{
return Rhymix\Framework\Lang::getSupportedList();
$list = Rhymix\Framework\Lang::getSupportedList();
return array_map(function($val) { return $val['name']; }, $list);
}
/**
@ -684,12 +685,12 @@ class Context
{
foreach ($selected as $lang)
{
$lang_selected[$lang] = $supported[$lang];
$lang_selected[$lang] = $supported[$lang]['name'];
}
}
else
{
$lang_selected = $supported;
$lang_selected = array_map(function($val) { return $val['name']; }, $supported);
}
}
return $lang_selected;

View file

@ -449,7 +449,7 @@ class HTMLDisplayHandler
$locales = (include \RX_BASEDIR . 'common/defaults/locales.php');
if (isset($locales[$lang_type]))
{
Context::addOpenGraphData('og:locale', $locales[$lang_type]);
Context::addOpenGraphData('og:locale', $locales[$lang_type]['locale']);
}
if ($page_type === 'article' && $oDocument->getLangCode() !== $lang_type && isset($locales[$oDocument->getLangCode()]))
{

View file

@ -57,7 +57,7 @@ return array(
'refresh' => 300,
),
'file' => array(
'umask' => '022',
'umask' => '0022',
),
'mail' => array(
'type' => 'mailfunction',

View file

@ -1,21 +0,0 @@
<?php
/**
* List of languages supported by Rhymix
*
* Copyright (c) Rhymix Developers and Contributors
*/
return array(
'ko' => '한국어',
'en' => 'English',
'ja' => '日本語',
'zh-CN' => '中文(中国)',
'zh-TW' => '中文(臺灣)',
'de' => 'Deutsch',
'es' => 'Español',
'fr' => 'Français',
'mn' => 'Mongolian',
'ru' => 'Русский',
'tr' => 'Türkçe',
'vi' => 'Tiếng Việt',
);

View file

@ -1,21 +1,21 @@
<?php
/**
* Conversion map from languages to locales
* Languages and locales supported by Rhymix
*
* Copyright (c) Rhymix Developers and Contributors
*/
return array(
'ko' => 'ko_KR',
'en' => 'en_US',
'ja' => 'ja_JP',
'zh-CN' => 'zh_CN',
'zh-TW' => 'zh_TW',
'de' => 'de_DE',
'es' => 'es_ES',
'fr' => 'fr_FR',
'mn' => 'mn_MN',
'ru' => 'ru_RU',
'tr' => 'tr_TR',
'vi' => 'vi_VN',
'ko' => array('name' => '한국어', 'locale' => 'ko_KR'),
'en' => array('name' => 'English', 'locale' => 'en_US'),
'ja' => array('name' => '日本語', 'locale' => 'ja_JP'),
'zh-CN' => array('name' => '中文(中国)', 'locale' => 'zh_CN'),
'zh-TW' => array('name' => '中文(臺灣)', 'locale' => 'zh_TW'),
'de' => array('name' => 'Deutsch', 'locale' => 'de_DE'),
'es' => array('name' => 'Español', 'locale' => 'es_ES'),
'fr' => array('name' => 'Français', 'locale' => 'fr_FR'),
'mn' => array('name' => 'Mongolian', 'locale' => 'mn_MN'),
'ru' => array('name' => 'Русский', 'locale' => 'ru_RU'),
'tr' => array('name' => 'Türkçe', 'locale' => 'tr_TR'),
'vi' => array('name' => 'Tiếng Việt', 'locale' => 'vi_VN'),
);

View file

@ -163,7 +163,12 @@ class Lang
*/
public static function getSupportedList()
{
return (include \RX_BASEDIR . 'common/defaults/lang.php');
static $list = null;
if ($list === null)
{
$list = (include \RX_BASEDIR . 'common/defaults/locales.php');
}
return $list;
}
/**

View file

@ -47,7 +47,7 @@
<div class="x_controls">
<label for="lang_{$key}" class="x_inline" loop="$supported_lang=>$key,$val">
<input type="checkbox" name="enabled_lang[]" id="lang_{$key}" value="{$key}" disabled="disabled"|cond="$key==$default_lang" checked="checked"|cond="in_array($key, $enabled_lang)" />
{$val}
{$val['name']}
</label>
</div>
</div>