Exemple #1
0
 function main($argc, $argv)
 {
     $this->stderrh = fopen('php://stderr', 'w');
     $this->parseArguments($argc, $argv);
     $MsgStore = new DBPoMsgStore();
     if ($this->doInstall) {
         $this->install($this->force);
         exit(0);
     }
     if ($this->catalogue_name) {
         $MsgStore->init($this->catalogue_name);
     }
     if ($this->infile) {
         if (!$this->catalogue_name) {
             die("Please provide a catalogue name\n");
         }
         $POParser = new POParser($MsgStore);
         $POParser->parseEntriesFromStream(fopen($this->infile, 'r'));
         if ($this->clean) {
             $POParser->cleanDatabase(fopen($this->infile, 'r'));
         }
         $this->echo_stderr(sprintf("%s parsed and saved\n", $this->infile));
         exit(0);
     }
     if ($this->outfile) {
         if (!$this->catalogue_name) {
             die("Please provide a catalogue name\n");
         }
         $POParser = new POParser($MsgStore);
         $POParser->writePoFileToStream(fopen($this->outfile, 'w'));
         $this->echo_stderr("{$this->outfile} successfully written\n\n");
         exit(0);
     }
     $this->usage();
 }
Exemple #2
0
msgstr ""

#: standard input:116 input:1115 input:1205
#: input:1838 input:1868 
#~ msgid "Password"
#~ "xxx"
#~ msgstr "Mot de passe:"
#~ "xxx"

FILE;
StringStreamController::createRef('reference', $easy_file);
$fh = fopen('string://reference', 'r');
$store = new TempPoMsgStore();
$t = new Tester();
$parser = new POParser($store);
$parser->parseEntriesFromStream($fh);
$objects = $store->read();
$t->assertTrue($objects[1]);
$t->assertTrue($objects[0]);
$t->assertFalse($objects[10]);
$t->assertTrue($objects[0]['msgid']);
$t->assertTrue($objects[0]['msgstr']);
$t->assertFalse($objects[0]['should_not_exist']);
$t->assertEquals($objects[0]['msgid'], 'Password');
$t->assertEquals($objects[0]['msgstr'], 'Mot de passe:');
$t->assertEquals($objects[1]['msgid'], "Hard idfoo bar\na \" quote");
$t->assertEquals($objects[2]['msgid'], 'Passwordxxx');
$t->assertEquals($objects[2]['msgstr'], 'Mot de passe:xxx');
$t->assertTrue($objects[2]['is_obsolete']);
$t1 = "dog";
$t2 = "foo\nbar";