파라미터없이 lang()함수 사용시 현재 사용하고 있는 언어타입 반환

lang 에 set 메소드를 추가함 (실제로 set이 되지않는 문제수정)
This commit is contained in:
conory 2016-03-06 16:35:01 +09:00
parent bd6f7d6542
commit fc09ea0d47
2 changed files with 29 additions and 3 deletions

View file

@ -32,7 +32,7 @@ function config($key, $value = null)
* @param string $value `$code`s value
* @return mixed
*/
function lang($code, $value = null)
function lang($code = null, $value = null)
{
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{
@ -40,14 +40,18 @@ function lang($code, $value = null)
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
}
if ($value === null)
if ($code !== null && $value === null)
{
return $GLOBALS['lang']->get($code);
}
else
else if ($code !== null && $value !== null)
{
$GLOBALS['lang']->set($code, $value);
}
else
{
return $GLOBALS['lang']->langType();
}
}
/**