Add the translation static.
authorGunnar Wrobel <p@rdus.de>
Fri, 22 Oct 2010 23:13:51 +0000 (01:13 +0200)
committerGunnar Wrobel <p@rdus.de>
Fri, 22 Oct 2010 23:13:51 +0000 (01:13 +0200)
framework/Itip/lib/Horde/Itip/Translation.php [new file with mode: 0644]
framework/Itip/package.xml

diff --git a/framework/Itip/lib/Horde/Itip/Translation.php b/framework/Itip/lib/Horde/Itip/Translation.php
new file mode 100644 (file)
index 0000000..716df81
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * @package Itip
+ *
+ * Copyright 2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ */
+
+/**
+ * Horde_Itip_Translation is the translation wrapper class for Horde_Itip.
+ *
+ * @author  Jan Schneider <jan@horde.org>
+ * @package Itip
+ */
+class Horde_Itip_Translation extends Horde_Translation
+{
+    /**
+     * Returns the translation of a message.
+     *
+     * @var string $message  The string to translate.
+     *
+     * @return string  The string translation, or the original string if no
+     *                 translation exists.
+     */
+    static public function t($message)
+    {
+        self::$_domain = 'Horde_Itip';
+        self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? '../../../locale' : '@data_dir@/Itip/locale';
+        return parent::t($message);
+    }
+
+    /**
+     * Returns the plural translation of a message.
+     *
+     * @param string $singular  The singular version to translate.
+     * @param string $plural    The plural version to translate.
+     * @param integer $number   The number that determines singular vs. plural.
+     *
+     * @return string  The string translation, or the original string if no
+     *                 translation exists.
+     */
+    static public function ngettext($singular, $plural, $number)
+    {
+        self::$_domain = 'Horde_Itip';
+        self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? '../../../locale' : '@data_dir@/Itip/locale';
+        return parent::ngettext($singular, $plural, $number);
+    }
+}
index 2551fe3..36444d3 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.9.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
+<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
  <name>Itip</name>
  <channel>pear.horde.org</channel>
  <summary>iTip invitation response handling.</summary>
@@ -23,8 +23,8 @@
   <email>jan@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2010-10-22</date>
- <time>19:02:58</time>
+ <date>2010-10-23</date>
+ <time>01:11:52</time>
  <version>
   <release>0.1.0</release>
   <api>0.1.0</api>
@@ -68,6 +68,9 @@
       <file name="Exception.php" role="php" />
       <file name="Resource.php" role="php" />
       <file name="Response.php" role="php" />
+      <file name="Translation.php" role="php">
+       <tasks:replace from="@data_dir@" to="data_dir" type="pear-config" />
+      </file>
      </dir> <!-- /lib/Horde/Itip -->
      <file name="Itip.php" role="php" />
     </dir> <!-- /lib/Horde -->
    <install as="Horde/Itip/Exception.php" name="lib/Horde/Itip/Exception.php" />
    <install as="Horde/Itip/Resource.php" name="lib/Horde/Itip/Resource.php" />
    <install as="Horde/Itip/Response.php" name="lib/Horde/Itip/Response.php" />
+   <install as="Horde/Itip/Translation.php" name="lib/Horde/Itip/Translation.php" />
    <install as="Horde/Itip/Event/Vevent.php" name="lib/Horde/Itip/Event/Vevent.php" />
    <install as="Horde/Itip/Resource/Base.php" name="lib/Horde/Itip/Resource/Base.php" />
    <install as="Horde/Itip/Resource/Identity.php" name="lib/Horde/Itip/Resource/Identity.php" />
     <release>alpha</release>
     <api>alpha</api>
    </stability>
-   <date>2010-10-22</date>
+   <date>2010-10-23</date>
    <license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</license>
    <notes>
 * Extracted package from Kolab_Resource.