summaryrefslogtreecommitdiff
path: root/tools/inc/lib/jsgettext/PoeditString.php
blob: 3d59d0044d7ec58d4d6f76b593e0e83be11c82ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
	}
}

?>