--- /dev/null
+<?php
+/**
+ * Horde_Translation test suite.
+ *
+ * @author Jan Schneider <jan@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @category Horde
+ * @package Translation
+ * @subpackage UnitTests
+ */
+
+/**
+ * Define the main method
+ */
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'Horde_Translation_AllTests::main');
+}
+
+/**
+ * Prepare the test setup.
+ */
+require_once 'Horde/Test/AllTests.php';
+
+/**
+ * @package Horde_Translation
+ * @subpackage UnitTests
+ */
+class Horde_Translation_AllTests extends Horde_Test_AllTests
+{
+}
+
+Horde_Translation_AllTests::init('Horde_Translation', __FILE__);
+
+if (PHPUnit_MAIN_METHOD == 'Horde_Translation_AllTests::main') {
+ Horde_Translation_AllTests::main();
+}
--- /dev/null
+<?php
+/**
+ * @author Jan Schneider <jan@horde.org>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @category Horde
+ * @package Translation
+ * @subpackage UnitTests
+ */
+
+class Horde_Translation_GettextTest extends PHPUnit_Framework_TestCase
+{
+ private $_dict;
+
+ public function setUp()
+ {
+ putenv('LC_ALL=de_DE.UTF-8');
+ putenv('LANG=de_DE.UTF-8');
+ putenv('LANGUAGE=de_DE.UTF-8');
+ $this->_dict = new Horde_Translation_Gettext('Horde_Translation', dirname(__FILE__) . '/locale');
+ }
+
+ public function testGettext()
+ {
+ $this->assertEquals('Heute', $this->_dict->t('Today'));
+ $this->assertEquals('Schön', $this->_dict->t('Beautiful'));
+ $this->assertEquals('2 Tage', sprintf($this->_dict->t('%d days'), 2));
+ }
+
+ public function testNgettext()
+ {
+ $this->assertEquals('1 Woche', sprintf($this->_dict->ngettext('%d week', '%d weeks', 1), 1));
+ $this->assertEquals('2 Wochen', sprintf($this->_dict->ngettext('%d week', '%d weeks', 2), 2));
+ }
+}
--- /dev/null
+# German test translation for Horde_Translation.
+# Copyright 2010 The Horde Project (http://www.horde.org/)
+# Jan Schneider <jan@horde.org>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: Horde_Translation\n"
+"Report-Msgid-Bugs-To: dev@lists.horde.org\n"
+"POT-Creation-Date: 2010-08-17 18:32+0200\n"
+"PO-Revision-Date: 2010-08-25 13:24+0200\n"
+"Last-Translator: Jan Schneider <jan@horde.org>\n"
+"Language-Team: German <dev@lists.horde.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8-bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgid "Today"
+msgstr "Heute"
+
+msgid "Beautiful"
+msgstr "Schön"
+
+#, php-format
+msgid "%d days"
+msgstr "%d Tage"
+
+#, php-format
+msgid "%d week"
+msgid_plural "%d weeks"
+msgstr[0] "%d Woche"
+msgstr[1] "%d Wochen"