cvs: pear /Translation2/Decorator DefaultText.php
| From: | Ian Eure | Date: | Tue, 26 Oct 2004 10:22:52 +0000 |
| Subject: | cvs: pear /Translation2/Decorator DefaultText.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-25240@lists.php.net to get a copy of this message | ||
ieure Tue Oct 26 06:22:52 2004 EDT
Modified files:
/pear/Translation2/Decorator DefaultText.php
Log:
Add translate() method.
http://cvs.php.net/diff.php/pear/Translation2/Decorator/DefaultText.php?r1=1.3&r2=1.4&ty=u
Index: pear/Translation2/Decorator/DefaultText.php
diff -u pear/Translation2/Decorator/DefaultText.php:1.3
pear/Translation2/Decorator/DefaultText.php:1.4
--- pear/Translation2/Decorator/DefaultText.php:1.3 Sat Jul 31 05:59:12 2004
+++ pear/Translation2/Decorator/DefaultText.php Tue Oct 26 06:22:52 2004
@@ -16,11 +16,11 @@
// | Authors: Lorenzo Alberton <l dot alberton at quipo dot it> |
// +----------------------------------------------------------------------+
//
-// $Id: DefaultText.php,v 1.3 2004/07/31 09:59:12 quipo Exp $
+// $Id: DefaultText.php,v 1.4 2004/10/26 10:22:52 ieure Exp $
//
/**
* @package Translation2
- * @version $Id: DefaultText.php,v 1.3 2004/07/31 09:59:12 quipo Exp $
+ * @version $Id: DefaultText.php,v 1.4 2004/10/26 10:22:52 ieure Exp $
*/
/**
* Load Translation2 decorator base class
@@ -95,5 +95,22 @@
}
// }}}
+ // {{{ translate
+
+ /**
+ * Translate a string with fallback
+ *
+ * If the requested string is unknown to the system, or no suitable
+ * translation exists, the requested string will be returned.
+ *
+ * @see Translation2::translate()
+ * @author Ian Eure
+ * @since 2.0.0beta3
+ */
+ function &translate($string, $langID = null, $pageID=TRANSLATION2_DEFAULT_PAGEID)
+ {
+ $stringID = $this->storage->getStringID($string, $pageID);
+ return $this->get($stringID, $pageID, $langID, $string);
+ }
}
?>
\ No newline at end of file