diff options
author | Filip Komar <filip@mageia.org> | 2012-08-15 10:49:55 +0000 |
---|---|---|
committer | Filip Komar <filip@mageia.org> | 2012-08-15 10:49:55 +0000 |
commit | f7461a814d7358c2773841b28890c915e60d65b0 (patch) | |
tree | dbc945b72211aa9a88f9bb59a65c0f54b81ab71f | |
parent | 783af2bf189f141ebbd5b3c54f6786d4e36b818d (diff) | |
download | www-f7461a814d7358c2773841b28890c915e60d65b0.tar www-f7461a814d7358c2773841b28890c915e60d65b0.tar.gz www-f7461a814d7358c2773841b28890c915e60d65b0.tar.bz2 www-f7461a814d7358c2773841b28890c915e60d65b0.tar.xz www-f7461a814d7358c2773841b28890c915e60d65b0.zip |
improved pa2lang.php: adding untranslated strings to all lang files, remove multiple spaces, backslashes
-rw-r--r-- | tools/pa2lang.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/pa2lang.php b/tools/pa2lang.php index 8c28d3960..95e926641 100644 --- a/tools/pa2lang.php +++ b/tools/pa2lang.php @@ -45,7 +45,7 @@ if (is_null($php_source)) { exit(1); } -echo "Loading ", $php_source, " looking for \$$var\n"; +echo "Loading " . $php_source . " looking for \$$var\n"; include $php_source; @@ -58,10 +58,14 @@ echo sprintf("Found %d locales here: %s.\n", count($$var), implode(', ', array_keys($$var))); $files = array(); +$eng_array = $$var; +$eng_array = $eng_array['en']; +$number_of_eng_strings = count($eng_array); foreach ($$var as $k => $v) { - echo sprintf("> %s has %d strings.", $k, count($v)); + echo sprintf("> %s has %d translated strings, adding the rest %d untranslated.", $k, count($v), ($number_of_eng_strings - count($v))); + $v = array_merge($eng_array, $v); // add untranslated strings $f = array(); $f[] = sprintf('# Generated by pa2lang.php on %s', date('c')); @@ -69,7 +73,9 @@ foreach ($$var as $k => $v) { foreach ($v as $s0 => $s1) { $s0 = str_replace("\n", ' ', $s0); - + $s0 = preg_replace('/\s+/', ' ', $s0); // remove multiple spaces + $s0 = str_replace("\'", "'", $s0); // remove also backslashes + if (is_array($s1)) { echo "\nWe have an array for string $k:'$s0':\n"; foreach ($s1 as $sv) @@ -79,6 +85,8 @@ foreach ($$var as $k => $v) { exit(1); } $s1 = str_replace("\n", ' ', $s1); + $s1 = preg_replace('/\s+/', ' ', $s1); + $s1 = str_replace("\'", "'", $s1); $f[] = ''; $f[] = ';' . $s0; |