diff options
Diffstat (limited to 'program')
-rw-r--r-- | program/include/main.inc | 10 | ||||
-rw-r--r-- | program/include/rcmail.php | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 3c04e20bf..842b93323 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -92,6 +92,16 @@ function rcube_label($p, $domain=null) return rcmail::get_instance()->gettext($p, $domain); } +/** + * Global wrapper of rcmail::text_exists() + * to check whether a text label is defined + * + * @see rcmail::text_exists() + */ +function rcube_label_exists($name, $domain=null) +{ + return rcmail::get_instance()->text_exists($name, $domain); +} /** * Overwrite action variable diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 7ef34724e..d29ebe780 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -915,6 +915,21 @@ class rcmail return $text; } + /** + * Check if the given text lable exists + * + * @param string Label name + * @return boolean True if text exists (either in the current language or in en_US) + */ + public function text_exists($name, $domain=null) + { + // load localization files if not done yet + if (empty($this->texts)) + $this->load_language(); + + // check for text with domain first + return ($domain && isset($this->texts[$domain.'.'.$name])) || isset($this->texts[$name]); + } /** * Load a localization package |