forked from leftypol/leftypol
tools/inc/lib/jsgettext/: bundle jsgettext library from https://code.google.com/p/jsgettext
This commit is contained in:
parent
de53ca0f8f
commit
12d1636b40
6 changed files with 334 additions and 0 deletions
29
tools/inc/lib/jsgettext/PoeditString.php
Normal file
29
tools/inc/lib/jsgettext/PoeditString.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
class PoeditString {
|
||||
public $key;
|
||||
public $value;
|
||||
public $fuzzy;
|
||||
public $comments;
|
||||
|
||||
function __construct($key, $value = '', $fuzzy = false, $comments = array()) {
|
||||
$this->key = $key;
|
||||
$this->value = $value;
|
||||
$this->fuzzy = $fuzzy;
|
||||
$this->comments = (array)$comments;
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
$str ='';
|
||||
foreach ($this->comments as $c) {
|
||||
$str .= "#: $c\n";
|
||||
}
|
||||
if ($this->fuzzy) $str .= "#, fuzzy\n";
|
||||
$str .= 'msgid "'.str_replace('"', '\\"', $this->key).'"' . "\n";
|
||||
$str .= 'msgstr "'.str_replace('"', '\\"', $this->value).'"' . "\n";
|
||||
$str .= "\n";
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue