parent
b38ef9c0bd
commit
0be8b97e88
|
@ -213,4 +213,76 @@ class TranslatorTest extends BaseTestCase
|
|||
'Translator::getPreferredLocaleCode does not return the default locale if no match could be found'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherSetupLocaleSetsUpTheGivenLocale
|
||||
*/
|
||||
public function testWhetherTranslatePluralReturnsTheSingularForm()
|
||||
{
|
||||
Translator::setupLocale('de_DE');
|
||||
|
||||
$result = Translator::translatePlural('test service', 'test services', 1, 'icingatest');
|
||||
|
||||
$expected = 'test dienst';
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$result,
|
||||
'Translator::translatePlural() could not return the translated singular form'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherSetupLocaleSetsUpTheGivenLocale
|
||||
*/
|
||||
public function testWhetherTranslatePluralReturnsThePluralForm()
|
||||
{
|
||||
Translator::setupLocale('de_DE');
|
||||
|
||||
$result = Translator::translatePlural('test service', 'test services', 2, 'icingatest');
|
||||
|
||||
$expected = 'test dienste';
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$result,
|
||||
'Translator::translatePlural() could not return the translated plural form'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherSetupLocaleSetsUpTheGivenLocale
|
||||
*/
|
||||
public function testWhetherTranslateReturnsTheContextForm()
|
||||
{
|
||||
Translator::setupLocale('de_DE');
|
||||
|
||||
$result = Translator::translate('context service', 'icingatest', 'test2');
|
||||
|
||||
$expected = 'context dienst test2';
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$result,
|
||||
'Translator::translate() could not return the translated context form'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherSetupLocaleSetsUpTheGivenLocale
|
||||
*/
|
||||
public function testWhetherTranslatePluralReturnsTheContextForm()
|
||||
{
|
||||
Translator::setupLocale('de_DE');
|
||||
|
||||
$result = Translator::translatePlural('context service', 'context services', 3, 'icingatest', 'test-context');
|
||||
|
||||
$expected = 'context plural dienste';
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$result,
|
||||
'Translator::translatePlural() could not return the translated context form'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,2 +1,42 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Icinga Web 2 Test (0.0.1)\n"
|
||||
"Report-Msgid-Bugs-To: dev@icinga.org\n"
|
||||
"POT-Creation-Date: 2014-09-16 13:29+0200\n"
|
||||
"PO-Revision-Date: 2014-09-16 16:08+0100\n"
|
||||
"Last-Translator: Alexander Fuhr <alexander.fuhr@netways.de>\n"
|
||||
"Language: de_DE\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 1.5.4\n"
|
||||
|
||||
msgid "Lorem ipsum dolor sit amet"
|
||||
msgstr "Lorem ipsum dolor sit amet!"
|
||||
msgstr "Lorem ipsum dolor sit amet!"
|
||||
|
||||
msgid "test service"
|
||||
msgid_plural "test services"
|
||||
msgstr[0] "test dienst"
|
||||
msgstr[1] "test dienste"
|
||||
|
||||
msgctxt "test"
|
||||
msgid "context service"
|
||||
msgstr "context dienst test"
|
||||
|
||||
msgctxt "test2"
|
||||
msgid "context service"
|
||||
msgstr "context dienst test2"
|
||||
|
||||
msgctxt "test-contextu"
|
||||
msgid "context service"
|
||||
msgid_plural "context services"
|
||||
msgstr[0] "context plural dienstu"
|
||||
msgstr[1] "context plural diensteu"
|
||||
|
||||
msgctxt "test-context"
|
||||
msgid "context service"
|
||||
msgid_plural "context services"
|
||||
msgstr[0] "context plural dienst"
|
||||
msgstr[1] "context plural dienste"
|
||||
|
|
Loading…
Reference in New Issue