Revert "Added a mock translation handler and translation factories."
authorJan Schneider <jan@horde.org>
Fri, 22 Oct 2010 12:27:17 +0000 (14:27 +0200)
committerJan Schneider <jan@horde.org>
Fri, 22 Oct 2010 17:27:03 +0000 (19:27 +0200)
This reverts commit 29bb2aca756f91a2be5c14d86a4c7239dd2b13d9.

framework/Translation/lib/Horde/Translation/Factory.php [deleted file]
framework/Translation/lib/Horde/Translation/Factory/Gettext.php [deleted file]
framework/Translation/lib/Horde/Translation/Factory/Mock.php [deleted file]
framework/Translation/lib/Horde/Translation/Mock.php [deleted file]
framework/Translation/package.xml
framework/Translation/test/Horde/Translation/Autoload.php [deleted file]
framework/Translation/test/Horde/Translation/FactoryTest.php [deleted file]
framework/Translation/test/Horde/Translation/GettextTest.php
framework/Translation/test/Horde/Translation/phpunit.xml [deleted file]

diff --git a/framework/Translation/lib/Horde/Translation/Factory.php b/framework/Translation/lib/Horde/Translation/Factory.php
deleted file mode 100644 (file)
index d8d128d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Interface describing a translation factory.
- *
- * PHP version 5
- *
- * 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.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-
-/**
- * Interface describing a translation factory.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-interface Horde_Translation_Factory
-{
-    /**
-     * Returns a translation handler. The relative path to the domains locale
-     * data will be preferred if the absolute path indicates that it is unset.
-     *
-     * @param string $domain   The domain of the translation handler.
-     * @param string $absolute The absolute path to the locale data for
-     *                         this handler.
-     * @param string $relative The relative path to the locale data for
-     *                         this handler.
-     *
-     * @return Horde_Translation The translation handler.
-     */
-    public function createTranslation($domain, $absolute, $relative);
-}
diff --git a/framework/Translation/lib/Horde/Translation/Factory/Gettext.php b/framework/Translation/lib/Horde/Translation/Factory/Gettext.php
deleted file mode 100644 (file)
index 2b81047..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Allows to create the gettext based translation handlers.
- *
- * PHP version 5
- *
- * 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.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-
-/**
- * Allows to create the gettext based translation handlers.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-class Horde_Translation_Factory_Gettext implements Horde_Translation_Factory
-{
-    /**
-     * Returns a translation handler. The relative path to the domains locale
-     * data will be preferred if the absolute path indicates that it is unset.
-     *
-     * @param string $domain   The domain of the translation handler.
-     * @param string $absolute The absolute path to the locale data for
-     *                         this handler.
-     * @param string $relative The relative path to the locale data for
-     *                         this handler.
-     *
-     * @return Horde_Translation The translation handler.
-     */
-    public function createTranslation($domain, $absolute, $relative)
-    {
-        return new Horde_Translation_Gettext(
-            $domain,
-            strpos($absolute, '@data_dir') === 0 ? $relative : $absolute
-        );
-    }
-}
diff --git a/framework/Translation/lib/Horde/Translation/Factory/Mock.php b/framework/Translation/lib/Horde/Translation/Factory/Mock.php
deleted file mode 100644 (file)
index 3f11c88..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Generates a mock translation handler.
- *
- * PHP version 5
- *
- * 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.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-
-/**
- * Generates a mock translation handler.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-class Horde_Translation_Factory_Mock implements Horde_Translation_Factory
-{
-    /**
-     * Returns a translation handler. The relative path to the domains locale
-     * data will be preferred if the absolute path indicates that it is unset.
-     *
-     * @param string $domain   The domain of the translation handler.
-     * @param string $absolute The absolute path to the locale data for
-     *                         this handler.
-     * @param string $relative The relative path to the locale data for
-     *                         this handler.
-     *
-     * @return Horde_Translation The translation handler.
-     */
-    public function createTranslation($domain, $absolute, $relative)
-    {
-        return new Horde_Translation_Mock();
-    }
-}
diff --git a/framework/Translation/lib/Horde/Translation/Mock.php b/framework/Translation/lib/Horde/Translation/Mock.php
deleted file mode 100644 (file)
index 506d13b..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * A mock translation that does not translate anything.
- *
- * PHP version 5
- *
- * 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.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-
-/**
- * A mock translation that does not translate anything.
- *
- * @category  Horde
- * @package   Translation
- * @author    Gunnar Wrobel <wrobel@pardus.de>
- * @license   http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link      http://pear.horde.org/index.php?package=Translation
- */
-class Horde_Translation_Mock implements Horde_Translation
-{
-    /**
-     * Returns the translation of a message.
-     *
-     * @param string $message  The string to translate.
-     *
-     * @return string  The string translation, or the original string if no
-     *                 translation exists.
-     */
-    public function t($message)
-    {
-        return $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.
-     */
-    public function ngettext($singular, $plural, $number)
-    {
-        return $number > 1 ? $plural : $singular;
-    }
-}
index 714b763..6ab343e 100644 (file)
@@ -10,8 +10,8 @@
   <email>jan@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2010-10-18</date>
- <time>11:41:56</time>
+ <date>2010-10-05</date>
+ <time>13:12:56</time>
  <version>
   <release>0.1.0</release>
   <api>0.1.0</api>
    <dir name="lib">
     <dir name="Horde">
      <dir name="Translation">
-      <dir name="Factory">
-       <file name="Gettext.php" role="php" />
-       <file name="Mock.php" role="php" />
-      </dir> <!-- /lib/Horde/Translation/Factory -->
-      <file name="Factory.php" role="php" />
       <file name="Gettext.php" role="php" />
-      <file name="Mock.php" role="php" />
-     </dir> <!-- /lib/Horde/Translation -->
+     </dir> <!-- //lib/Horde/Translation -->
      <file name="Translation.php" role="php" />
-    </dir> <!-- /lib/Horde -->
-   </dir> <!-- /lib -->
-   <dir name="test">
-    <dir name="Horde">
-     <dir name="Translation">
-      <dir name="locale">
-       <dir name="de">
-        <dir name="LC_MESSAGES">
-         <file name="Horde_Other.mo" role="test" />
-         <file name="Horde_Other.po" role="test" />
-         <file name="Horde_Translation.mo" role="test" />
-         <file name="Horde_Translation.po" role="test" />
-        </dir> <!-- /test/Horde/Translation/locale/de/LC_MESSAGES -->
-       </dir> <!-- /test/Horde/Translation/locale/de -->
-      </dir> <!-- /test/Horde/Translation/locale -->
-      <file name="AllTests.php" role="test" />
-      <file name="Autoload.php" role="test" />
-      <file name="FactoryTest.php" role="test" />
-      <file name="GettextTest.php" role="test" />
-     </dir> <!-- /test/Horde/Translation -->
-    </dir> <!-- /test/Horde -->
-   </dir> <!-- /test -->
+    </dir> <!-- //lib/Horde -->
+   </dir> <!-- //lib -->
   </dir> <!-- / -->
  </contents>
  <dependencies>
  <phprelease>
   <filelist>
    <install as="Horde/Translation.php" name="lib/Horde/Translation.php" />
-   <install as="Horde/Translation/Factory.php" name="lib/Horde/Translation/Factory.php" />
    <install as="Horde/Translation/Gettext.php" name="lib/Horde/Translation/Gettext.php" />
-   <install as="Horde/Translation/Mock.php" name="lib/Horde/Translation/Mock.php" />
-   <install as="Horde/Translation/Factory/Gettext.php" name="lib/Horde/Translation/Factory/Gettext.php" />
-   <install as="Horde/Translation/Factory/Mock.php" name="lib/Horde/Translation/Factory/Mock.php" />
-   <install as="Horde/Translation/AllTests.php" name="test/Horde/Translation/AllTests.php" />
-   <install as="Horde/Translation/Autoload.php" name="test/Horde/Translation/Autoload.php" />
-   <install as="Horde/Translation/FactoryTest.php" name="test/Horde/Translation/FactoryTest.php" />
-   <install as="Horde/Translation/GettextTest.php" name="test/Horde/Translation/GettextTest.php" />
-   <install as="Horde/Translation/locale/de/LC_MESSAGES/Horde_Other.mo" name="test/Horde/Translation/locale/de/LC_MESSAGES/Horde_Other.mo" />
-   <install as="Horde/Translation/locale/de/LC_MESSAGES/Horde_Other.po" name="test/Horde/Translation/locale/de/LC_MESSAGES/Horde_Other.po" />
-   <install as="Horde/Translation/locale/de/LC_MESSAGES/Horde_Translation.mo" name="test/Horde/Translation/locale/de/LC_MESSAGES/Horde_Translation.mo" />
-   <install as="Horde/Translation/locale/de/LC_MESSAGES/Horde_Translation.po" name="test/Horde/Translation/locale/de/LC_MESSAGES/Horde_Translation.po" />
   </filelist>
  </phprelease>
  <changelog>
     <release>beta</release>
     <api>beta</api>
    </stability>
-   <date>2010-10-18</date>
+   <date>2010-10-05</date>
    <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
    <notes>
 * Initial release.
diff --git a/framework/Translation/test/Horde/Translation/Autoload.php b/framework/Translation/test/Horde/Translation/Autoload.php
deleted file mode 100644 (file)
index fdc7723..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Setup autoloading for the tests.
- *
- * PHP version 5
- *
- * Copyright 2009-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.
- *
- * @category   Horde
- * @package    Translation
- * @subpackage UnitTests
- * @author     Gunnar Wrobel <wrobel@pardus.de>
- * @license    http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link       http://pear.horde.org/index.php?package=Translation
- */
-
-require_once 'Horde/Test/Autoload.php';
-
-/** Catch strict standards */
-error_reporting(E_ALL | E_STRICT);
diff --git a/framework/Translation/test/Horde/Translation/FactoryTest.php b/framework/Translation/test/Horde/Translation/FactoryTest.php
deleted file mode 100644 (file)
index 2f3938c..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
- * Test the translation factory.
- *
- * PHP version 5
- *
- * @category   Horde
- * @package    Translation
- * @subpackage UnitTests
- * @author     Gunnar Wrobel <wrobel@pardus.de>
- * @license    http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link       http://pear.horde.org/index.php?package=Translation
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/Autoload.php';
-
-/**
- * Test the translation factory.
- *
- * 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.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- *
- * @category   Horde
- * @package    Translation
- * @subpackage UnitTests
- * @author     Gunnar Wrobel <wrobel@pardus.de>
- * @license    http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link       http://pear.horde.org/index.php?package=Translation
- */
-class Horde_Translation_FactoryTest
-extends PHPUnit_Framework_TestCase
-{
-    public function testFactoryCreatesTranslationInstance()
-    {
-        $factory = new Horde_Translation_Factory_Gettext();
-        $this->assertType(
-            'Horde_Translation_Gettext',
-            $factory->createTranslation(
-                'Test',
-                '@data_dir@',
-                dirname(__FILE__) . '/locale'
-            )
-        );
-    }
-
-    public function testMockFactoryCreatesMockTranslationInstance()
-    {
-        $factory = new Horde_Translation_Factory_Mock();
-        $this->assertType(
-            'Horde_Translation_Mock',
-            $factory->createTranslation('Test', '', '')
-        );
-    }
-}
\ No newline at end of file
index f79f724..bc3c327 100644 (file)
@@ -7,11 +7,6 @@
  * @subpackage UnitTests
  */
 
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/Autoload.php';
-
 class Horde_Translation_GettextTest extends PHPUnit_Framework_TestCase
 {
     private $_dict;
diff --git a/framework/Translation/test/Horde/Translation/phpunit.xml b/framework/Translation/test/Horde/Translation/phpunit.xml
deleted file mode 100644 (file)
index 502d3c9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit>
-  <filter>
-    <whitelist>
-      <directory suffix=".php">../../../lib</directory>
-    </whitelist>
-  </filter>
-</phpunit>