Пример #1
0
 public function testNgettext()
 {
     $g = new Gettext_Extension('./', 'gettext', 'de');
     $this->assertEquals('Datei existiert nicht', $g->ngettext('File does not exist', 'Files donnot exists', 1));
     $this->assertEquals('Datei ist zu klein', $g->ngettext('File is too small', 'Files are too small', 1));
     $this->assertEquals('Foobar', $g->ngettext('Foobar', 'Foobar', 1));
     $this->assertEquals('Datei existiert nicht', $g->ngettext('File does not exist', 'Files donnot exists', 2));
     $this->assertEquals('Dateien sind zu klein', $g->ngettext('File is too small', 'Files are too small', 2));
     $this->assertEquals('Foobar', $g->ngettext('Foobar', 'Foobar', 2));
     $this->assertContains('Last-Translator', $g->ngettext(null, null, 1));
     $this->assertEquals('Dateien sind zu klein', $g->ngettext('File is too small', 'Files are too small', -1));
     $this->assertEquals('Dateien sind zu klein', $g->ngettext('File is too small', 'Files are too small', 0));
 }
Пример #2
0
<?php

include_once "Gettext.php";
$dirname = realpath(dirname($_SERVER['SCRIPT_FILENAME']));
$gn = new Gettext_PHP($dirname . "/", "gettext", "de");
$ge = new Gettext_Extension($dirname . "/", "gettext", "de");
var_dump($gn->gettext("File does not exist"));
var_dump($ge->gettext("File does not exist"));
var_dump($gn->gettext("File does not exist") == $ge->gettext("File does not exist"));
var_dump($gn->ngettext("File is too small", "Files are too small", 1));
var_dump($ge->ngettext("File is too small", "Files are too small", 1));
var_dump($gn->ngettext("File is too small", "Files are too small", 1) == $ge->ngettext("File is too small", "Files are too small", 1));
var_dump($gn->ngettext("File is too small", "Files are too small", 2));
var_dump($ge->ngettext("File is too small", "Files are too small", 2));
var_dump($gn->ngettext("File is too small", "Files are too small", 2) == $ge->ngettext("File is too small", "Files are too small", 2));