mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
lang() 함수 추가
This commit is contained in:
parent
7b75a103b2
commit
bd6f7d6542
1 changed files with 25 additions and 0 deletions
|
|
@ -25,6 +25,31 @@ function config($key, $value = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or set lang variable.
|
||||||
|
*
|
||||||
|
* @param string $code Lang variable name
|
||||||
|
* @param string $value `$code`s value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function lang($code, $value = null)
|
||||||
|
{
|
||||||
|
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
|
||||||
|
{
|
||||||
|
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(Context::getLangType() ?: config('locale.default_lang') ?: 'ko');
|
||||||
|
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($value === null)
|
||||||
|
{
|
||||||
|
return $GLOBALS['lang']->get($code);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$GLOBALS['lang']->set($code, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first value of an array.
|
* Get the first value of an array.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue