From b0e15407a664677201a3b9b8251786652b5e147f Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sat, 8 Mar 2014 21:21:32 +0000 Subject: further preparation of l10n report family w/o 3 exceptions (nav, license, constitution) to gettext system --- langs/lib.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'langs/lib.php') diff --git a/langs/lib.php b/langs/lib.php index 05740418d..15f133131 100644 --- a/langs/lib.php +++ b/langs/lib.php @@ -91,13 +91,13 @@ function _po_diff($locale, $resource) $missing = array(); foreach ($source_l as $escaped_string => $subarray) { - if ($escaped_string == $subarray["msgid"]) { // filter out header + if (!empty($subarray["msgid"])) { // filter out header $pot_strings[$escaped_string] = $subarray["msgid"]; } } foreach ($target_l as $escaped_string => $subarray) { - if ($escaped_string == $subarray["msgid"]) { // filter out header + if (!empty($subarray["msgid"])) { // filter out header $po_strings[$escaped_string] = $subarray["msgstr"][0]; } } @@ -115,10 +115,10 @@ function _po_diff($locale, $resource) return array( 'a' => count($pot_strings), // # of original strings // 'b' => count($po_strings), // # of target strings - 'missing' => $missing, // probably could be empty array() of missing strings - 'notrans' => $untrans, // array of untranslated strings - 'extra' => array(), // could be empty array() of unused (old) strings - 'dup_str' => array(), // could be empty array() of duplicate strings + 'missing' => $missing, + 'notrans' => $untrans, + 'extra' => array(), + 'dup_str' => array(), ); } @@ -189,7 +189,9 @@ function _lang_file_switch($s, $l) */ function _po_file_switch($s, $l) { - $s = str_replace('.pot', '.po', $s); + if($l != 'en') { + $s = str_replace('.pot', '.po', $s); + } return str_replace('en/', $l . '/', $s); } @@ -208,9 +210,9 @@ function _extract_resource($source_file, $extension = '.pot') return str_replace('en/', '', $resource); } -function get_lang_references() +function get_lang_references($pattern = '*') { - return glob_recursive('en/*', GLOB_MARK); + return glob_recursive('en/' . $pattern, GLOB_MARK); } function get_other_langs() -- cgit v1.2.1