aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/language/language.php
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2015-08-23 22:42:18 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2015-08-23 22:42:18 +0200
commitf6a4843c6df3a9b0490eb3d273ebed7d04a89582 (patch)
treeb031ba516adf54d5d3764528e696651b02ceef92 /phpBB/phpbb/language/language.php
parentf56fe0ba8da2211d3947369e79952f294cffe7d6 (diff)
parent25103698040977fd0d655d6e658157a07bb24990 (diff)
downloadforums-f6a4843c6df3a9b0490eb3d273ebed7d04a89582.tar
forums-f6a4843c6df3a9b0490eb3d273ebed7d04a89582.tar.gz
forums-f6a4843c6df3a9b0490eb3d273ebed7d04a89582.tar.bz2
forums-f6a4843c6df3a9b0490eb3d273ebed7d04a89582.tar.xz
forums-f6a4843c6df3a9b0490eb3d273ebed7d04a89582.zip
Merge pull request #3652 from Elsensee/ticket/12143
[ticket/12143] Make it possible to use translated group names for non-special groups * Elsensee/ticket/12143: [ticket/12143] Fix tests after rebase [ticket/12143] Avoid no output from get_group_name() [ticket/12143] Fix those tests [ticket/12143] Add some tests [ticket/12143] Oops, fixed array index [ticket/12143] Replace group name output [ticket/12143] Add group helper class to translate groupnames [ticket/12143] Add is_set method to language service
Diffstat (limited to 'phpBB/phpbb/language/language.php')
-rw-r--r--phpBB/phpbb/language/language.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/phpbb/language/language.php b/phpBB/phpbb/language/language.php
index 44131e3da3..3ffb466c19 100644
--- a/phpBB/phpbb/language/language.php
+++ b/phpBB/phpbb/language/language.php
@@ -194,6 +194,36 @@ class language
}
/**
+ * @param $key array|string The language key we want to know more about. Can be string or array.
+ *
+ * @return bool Returns whether the language key is set.
+ */
+ public function is_set($key)
+ {
+ // Load common language files if they not loaded yet
+ if (!$this->common_language_files_loaded)
+ {
+ $this->load_common_language_files();
+ }
+
+ if (is_array($key))
+ {
+ $lang = &$this->lang[array_shift($key)];
+
+ foreach ($key as $_key)
+ {
+ $lang = &$lang[$_key];
+ }
+ }
+ else
+ {
+ $lang = &$this->lang[$key];
+ }
+
+ return isset($lang);
+ }
+
+ /**
* Advanced language substitution
*
* Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms.