diff options
author | Filip Komar <filip@mageia.org> | 2014-03-08 21:21:32 +0000 |
---|---|---|
committer | Filip Komar <filip@mageia.org> | 2014-03-08 21:21:32 +0000 |
commit | b0e15407a664677201a3b9b8251786652b5e147f (patch) | |
tree | 0b27bd5d843ba2f3e00831e4b90efdc73bf271b9 /langs/report.php | |
parent | 42fa789ce0ea2df5240c17e0ea35e2a1f1a6742c (diff) | |
download | www-b0e15407a664677201a3b9b8251786652b5e147f.tar www-b0e15407a664677201a3b9b8251786652b5e147f.tar.gz www-b0e15407a664677201a3b9b8251786652b5e147f.tar.bz2 www-b0e15407a664677201a3b9b8251786652b5e147f.tar.xz www-b0e15407a664677201a3b9b8251786652b5e147f.zip |
further preparation of l10n report family w/o 3 exceptions (nav, license, constitution) to gettext system
Diffstat (limited to 'langs/report.php')
-rw-r--r-- | langs/report.php | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/langs/report.php b/langs/report.php index 17db69d4e..25ea9a398 100644 --- a/langs/report.php +++ b/langs/report.php @@ -40,7 +40,6 @@ include 'lib.php'; $one_language = isset($_GET['l']) ? strip_tags(trim($_GET['l'])) : null; $one_resource = isset($_GET['r']) ? strip_tags(trim($_GET['r'])) : null; - define('APP_ROOT', realpath(__DIR__ . '/..')); $restore_languages = FALSE; $restore_resources = FALSE; @@ -49,8 +48,8 @@ $enFiles = array($one_resource); $restore_resources = TRUE; } else { - $enFiles = get_lang_references(); - array_unshift($enFiles, '../_nav/langs/en.lang'); // added navigation file + $enFiles = array_merge(array('../_nav/langs/en.lang'), get_lang_references('*.lang'), get_lang_references('*.pot')); // added navigation file + sort($enFiles); } if (isset($one_language) && $one_language != 'all') { @@ -91,6 +90,15 @@ foreach ($enFiles as $f) { + if (strrpos($f, '.pot')) { + $gettext = true; + $resource = _extract_resource($f); + $langF = _po_file_switch($f, $l); + } else { + $gettext = false; + $resource = _extract_resource($f, '.en.lang'); + $langF = _lang_file_switch($f, $l); + } $enStringsCount[$f] = 0; if ($f == '../_nav/langs/en.lang') { $nav = true; @@ -98,19 +106,18 @@ $nav = false; } - $langF = str_replace('.en.lang', '.' . $l . '.lang', $f); if ($nav) { $langF = '../_nav/langs/' . $l . '.lang'; } else { $langF = $l . substr($langF, 2); } - $link = str_replace(array('en/', '.en.lang', 'index'), '', $f); + $link = str_replace('index', '', $resource); if ($nav) { - $dest_en = sprintf('%s/%s/%s', APP_ROOT, '_nav/langs', 'en.lang'); - $dest_l = sprintf('%s/%s/%s', APP_ROOT, '_nav/langs', $l . '.lang'); + $dest_en = sprintf('%s/%s/%s', G_APP_ROOT, '_nav/langs', 'en.lang'); + $dest_l = sprintf('%s/%s/%s', G_APP_ROOT, '_nav/langs', $l . '.lang'); } else { - $dest_en = sprintf('%s/%s/%s/%s', APP_ROOT, 'en', $link, 'index.php'); - $dest_l = sprintf('%s/%s/%s/%s', APP_ROOT, $l, $link, 'index.php'); + $dest_en = sprintf('%s/%s/%s/%s', G_APP_ROOT, 'en', $link, 'index.php'); + $dest_l = sprintf('%s/%s/%s/%s', G_APP_ROOT, $l, $link, 'index.php'); } // if symlink e.g. does directly translated page exist? @@ -126,12 +133,16 @@ $stats[$l]['files'] += 1; - $test = _lang_diff($f, $langF); + if ($gettext) { + $test = _po_diff($l, $resource); + } else { + $test = _lang_diff($f, $langF); + } $num_of_untranslated_strings = count($test['notrans']); $num_of_duplicated_strings = count($test['dup_str']); if ($link == 'about/constitution') { - $constitution_results = aproximate_number_of_untranslated_constitution_lines(APP_ROOT, $l, $unique_lines_in_eng_constitution); + $constitution_results = aproximate_number_of_untranslated_constitution_lines(G_APP_ROOT, $l, $unique_lines_in_eng_constitution); if ($l == 'en') { $unique_lines_in_eng_constitution = $constitution_results['unique_lines_in_constitution']; $number_of_unique_lines_in_eng_constitution = count($unique_lines_in_eng_constitution); |