mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/14432] Adds a method to get raw language values
PHPBB3-14432
This commit is contained in:
@@ -246,14 +246,14 @@ class language
|
||||
}
|
||||
|
||||
/**
|
||||
* Act like lang() but takes a key and an array of parameters instead of using variadic
|
||||
* Returns the raw value associated to a language key or the language key no translation is available.
|
||||
* No parameter substitution is performed, can be a string or an array.
|
||||
*
|
||||
* @param string|array $key Language key
|
||||
* @param array $args Parameters
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function lang_array($key, $args = array())
|
||||
public function lang_raw($key)
|
||||
{
|
||||
// Load common language files if they not loaded yet
|
||||
if (!$this->common_language_files_loaded)
|
||||
@@ -281,6 +281,26 @@ class language
|
||||
return $key;
|
||||
}
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Act like lang() but takes a key and an array of parameters instead of using variadic
|
||||
*
|
||||
* @param string|array $key Language key
|
||||
* @param array $args Parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function lang_array($key, $args = array())
|
||||
{
|
||||
$lang = $this->lang_raw($key);
|
||||
|
||||
if ($lang === $key)
|
||||
{
|
||||
return $key;
|
||||
}
|
||||
|
||||
// If the language entry is a string, we simply mimic sprintf() behaviour
|
||||
if (is_string($lang))
|
||||
{
|
||||
|
Reference in New Issue
Block a user