From a1c652dae6b0c59454b367db48eada003d471ea2 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 22 Oct 2010 14:27:17 +0200 Subject: [PATCH] Revert "Added a mock translation handler and translation factories." This reverts commit 29bb2aca756f91a2be5c14d86a4c7239dd2b13d9. --- .../Translation/lib/Horde/Translation/Factory.php | 43 ---------------- .../lib/Horde/Translation/Factory/Gettext.php | 49 ------------------ .../lib/Horde/Translation/Factory/Mock.php | 46 ----------------- .../Translation/lib/Horde/Translation/Mock.php | 57 -------------------- framework/Translation/package.xml | 50 +++--------------- .../test/Horde/Translation/Autoload.php | 23 --------- .../test/Horde/Translation/FactoryTest.php | 60 ---------------------- .../test/Horde/Translation/GettextTest.php | 5 -- .../Translation/test/Horde/Translation/phpunit.xml | 8 --- 9 files changed, 6 insertions(+), 335 deletions(-) delete mode 100644 framework/Translation/lib/Horde/Translation/Factory.php delete mode 100644 framework/Translation/lib/Horde/Translation/Factory/Gettext.php delete mode 100644 framework/Translation/lib/Horde/Translation/Factory/Mock.php delete mode 100644 framework/Translation/lib/Horde/Translation/Mock.php delete mode 100644 framework/Translation/test/Horde/Translation/Autoload.php delete mode 100644 framework/Translation/test/Horde/Translation/FactoryTest.php delete mode 100644 framework/Translation/test/Horde/Translation/phpunit.xml diff --git a/framework/Translation/lib/Horde/Translation/Factory.php b/framework/Translation/lib/Horde/Translation/Factory.php deleted file mode 100644 index d8d128dc7..000000000 --- a/framework/Translation/lib/Horde/Translation/Factory.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @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 - * @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 index 2b810470b..000000000 --- a/framework/Translation/lib/Horde/Translation/Factory/Gettext.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @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 - * @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 index 3f11c8877..000000000 --- a/framework/Translation/lib/Horde/Translation/Factory/Mock.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @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 - * @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 index 506d13bc0..000000000 --- a/framework/Translation/lib/Horde/Translation/Mock.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @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 - * @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; - } -} diff --git a/framework/Translation/package.xml b/framework/Translation/package.xml index 714b763cf..6ab343ecd 100644 --- a/framework/Translation/package.xml +++ b/framework/Translation/package.xml @@ -10,8 +10,8 @@ jan@horde.org yes - 2010-10-18 - + 2010-10-05 + 0.1.0 0.1.0 @@ -29,37 +29,11 @@ - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - + + @@ -80,19 +54,7 @@ - - - - - - - - - - - - @@ -105,7 +67,7 @@ beta beta - 2010-10-18 + 2010-10-05 LGPL * Initial release. diff --git a/framework/Translation/test/Horde/Translation/Autoload.php b/framework/Translation/test/Horde/Translation/Autoload.php deleted file mode 100644 index fdc7723f7..000000000 --- a/framework/Translation/test/Horde/Translation/Autoload.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @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 index 2f3938cca..000000000 --- a/framework/Translation/test/Horde/Translation/FactoryTest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @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 - * @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 diff --git a/framework/Translation/test/Horde/Translation/GettextTest.php b/framework/Translation/test/Horde/Translation/GettextTest.php index f79f72467..bc3c327a5 100644 --- a/framework/Translation/test/Horde/Translation/GettextTest.php +++ b/framework/Translation/test/Horde/Translation/GettextTest.php @@ -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 index 502d3c9b8..000000000 --- a/framework/Translation/test/Horde/Translation/phpunit.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - ../../../lib - - - -- 2.11.0