mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
파라미터없이 lang()함수 사용시 현재 사용하고 있는 언어타입 반환
lang 에 set 메소드를 추가함 (실제로 set이 되지않는 문제수정)
This commit is contained in:
parent
bd6f7d6542
commit
fc09ea0d47
2 changed files with 29 additions and 3 deletions
|
|
@ -50,6 +50,16 @@ class Lang
|
||||||
$this->_loaded_plugins['_custom_'] = new \stdClass();
|
$this->_loaded_plugins['_custom_'] = new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return language type.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function langType()
|
||||||
|
{
|
||||||
|
return $this->_language;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load translations from a plugin (module, addon).
|
* Load translations from a plugin (module, addon).
|
||||||
*
|
*
|
||||||
|
|
@ -187,6 +197,18 @@ class Lang
|
||||||
return $this->__call($key, $args);
|
return $this->__call($key, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic setter.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param string $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($key, $value)
|
||||||
|
{
|
||||||
|
$this->__set($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic method for translations without arguments.
|
* Magic method for translations without arguments.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ function config($key, $value = null)
|
||||||
* @param string $value `$code`s value
|
* @param string $value `$code`s value
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function lang($code, $value = null)
|
function lang($code = null, $value = null)
|
||||||
{
|
{
|
||||||
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
|
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
|
||||||
{
|
{
|
||||||
|
|
@ -40,14 +40,18 @@ function lang($code, $value = null)
|
||||||
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
|
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value === null)
|
if ($code !== null && $value === null)
|
||||||
{
|
{
|
||||||
return $GLOBALS['lang']->get($code);
|
return $GLOBALS['lang']->get($code);
|
||||||
}
|
}
|
||||||
else
|
else if ($code !== null && $value !== null)
|
||||||
{
|
{
|
||||||
$GLOBALS['lang']->set($code, $value);
|
$GLOBALS['lang']->set($code, $value);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $GLOBALS['lang']->langType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue