diff options
author | Filip Komar <filip@mageia.org> | 2013-07-10 19:36:09 +0000 |
---|---|---|
committer | Filip Komar <filip@mageia.org> | 2013-07-10 19:36:09 +0000 |
commit | 783d75b31ef0d0d2b88643812256d3f038c1b7a1 (patch) | |
tree | b46e9784506c5490b2ce33b174c50a611aa59d8e /en/about/license/php-mo.php | |
parent | 02d28e2032ace010310dca693e2c151439c950f6 (diff) | |
download | www-783d75b31ef0d0d2b88643812256d3f038c1b7a1.tar www-783d75b31ef0d0d2b88643812256d3f038c1b7a1.tar.gz www-783d75b31ef0d0d2b88643812256d3f038c1b7a1.tar.bz2 www-783d75b31ef0d0d2b88643812256d3f038c1b7a1.tar.xz www-783d75b31ef0d0d2b88643812256d3f038c1b7a1.zip |
updated and debuged license page
Diffstat (limited to 'en/about/license/php-mo.php')
-rw-r--r-- | en/about/license/php-mo.php | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/en/about/license/php-mo.php b/en/about/license/php-mo.php index 4d5489ca2..6e2159a25 100644 --- a/en/about/license/php-mo.php +++ b/en/about/license/php-mo.php @@ -69,21 +69,26 @@ function phpmo_parse_po_file($in) { // state $state = null; $fuzzy = false; - $num = 0; // qq // iterate over lines while(($line = fgets($fh, 65536)) !== false) { - $num++; // qq $line = trim($line); - if ($line === '') + if ($line === '') { + // save stored entry on empty line + // block moved to fix "fuzzy flag first line" bug which didn't saved previous proper string at all + if (sizeof($temp) && array_key_exists('msgid', $temp) && array_key_exists('msgstr', $temp)) { + if (!$fuzzy) + $hash[] = $temp; + $temp = array (); + $state = null; + $fuzzy = false; + } continue; - + } $array_of_splited_string = preg_split('/\s/', $line, 2); $key = $array_of_splited_string[0]; $data = (isset($array_of_splited_string[1]) ? $array_of_splited_string[1] : ''); -// echo PHP_EOL . ' $key: ' . $key . ' ' . PHP_EOL . '$data: ' . $data . ' ' . PHP_EOL . '$line: ' . $line . PHP_EOL; - switch ($key) { case '#,' : // flag... $fuzzy = in_array('fuzzy', preg_split('/,\s*/', $data)); @@ -91,14 +96,11 @@ function phpmo_parse_po_file($in) { case '#.' : // extracted-comments case '#:' : // reference... case '#|' : // msgid previous-untranslated-string - // start a new entry - if (sizeof($temp) && array_key_exists('msgid', $temp) && array_key_exists('msgstr', $temp)) { - if (!$fuzzy) - $hash[] = $temp; - $temp = array (); - $state = null; - $fuzzy = false; - } + break; + case '#~' : // commented-unused-string + $temp = array (); + $state = null; + $fuzzy = false; break; case 'msgctxt' : // context @@ -133,7 +135,6 @@ function phpmo_parse_po_file($in) { default : // parse error fclose($fh); - echo ' $line: ' . $line . ' $key: ' . $key . ' $num: ' . $num . ' $data: ' . $data . ' $state: ' . $state . ' '; // qq return FALSE; } } |