Skip to content
Browse files

Fix incomplete backport from trunk

  • Loading branch information...
1 parent 3b4dee3 commit a02cfa9b085fc875fc55f57029a8e5846771ed5e @thomascube thomascube committed Aug 13, 2011
Showing with 25 additions and 0 deletions.
  1. +10 −0 program/include/main.inc
  2. +15 −0 program/include/rcmail.php
View
10 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
View
15 program/include/rcmail.php
@@ -915,6 +915,21 @@ public function gettext($attrib, $domain=null)
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

0 comments on commit a02cfa9

Please sign in to comment.
Something went wrong with that request. Please try again.