mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-21 11:56:04 +01:00
29 lines
613 B
PHP
29 lines
613 B
PHP
|
<?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;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|