+++ /dev/null
-<?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);
-}
+++ /dev/null
-<?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
- );
- }
-}
+++ /dev/null
-<?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();
- }
-}
+++ /dev/null
-<?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;
- }
-}
<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.
+++ /dev/null
-<?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);
+++ /dev/null
-<?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
* @subpackage UnitTests
*/
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/Autoload.php';
-
class Horde_Translation_GettextTest extends PHPUnit_Framework_TestCase
{
private $_dict;
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit>
- <filter>
- <whitelist>
- <directory suffix=".php">../../../lib</directory>
- </whitelist>
- </filter>
-</phpunit>