aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-02-01 12:07:02 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-02-01 12:07:02 +0100
commit3d67606e16d0ec85362e4bb9e68fdc7484150d80 (patch)
tree00459284f75a92b355e9474d86e83500732f970d /phpBB
parent63fd2159e015a36c778115c943cca2d11bcb46e1 (diff)
parentf5ca8c363bbd6776e9be8d2e05c3cf54685b0a59 (diff)
downloadforums-3d67606e16d0ec85362e4bb9e68fdc7484150d80.tar
forums-3d67606e16d0ec85362e4bb9e68fdc7484150d80.tar.gz
forums-3d67606e16d0ec85362e4bb9e68fdc7484150d80.tar.bz2
forums-3d67606e16d0ec85362e4bb9e68fdc7484150d80.tar.xz
forums-3d67606e16d0ec85362e4bb9e68fdc7484150d80.zip
Merge pull request #4145 from Nicofuma/ticket/14432
[ticket/14432] Adds a method to get raw language values
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/language/language.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php
index 382d4db89e..42429c2c07 100644
--- a/phpBB/phpbb/language/language.php
+++ b/phpBB/phpbb/language/language.php
@@ -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))
{