From 4e92fedb5a6314351b255ae19d64227339b95274 Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Sat, 10 Aug 2013 14:55:24 +0000 Subject: report page extended to show duplicate strings in lang files --- langs.inc.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'langs.inc.php') diff --git a/langs.inc.php b/langs.inc.php index b06cfed04..da15b73d4 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -338,10 +338,11 @@ class i18n * Get all locales from given file. * * @param string $file + * @param string $return_duplicates optional switch * * @return array */ - public static function _lang_return($file) + public static function _lang_return($file, $return_duplicates = false) { $strings = array(); @@ -356,9 +357,15 @@ class i18n if ($C === ';' && !empty($f[$k+1])) { $j = trim(substr($v, 1)); $j = str_replace(array("\'", "\""), array("'", '"'), $j); + if ($return_duplicates && !empty($strings[$j])) { + $duplicates[] = $j; + } $strings[$j] = trim($f[$k+1]); } } + if (!empty($duplicates)) { + $strings['duplicates'] = $duplicates; + } } return $strings; @@ -404,5 +411,3 @@ function _e($s = null, $args = null) { return i18n::_e($s, $args); } function _h($s = null, $args = null, $tag = 'p') { return i18n::_h($s, $args, $tag); } function _lang_load($locale, $domain) { return i18n::_lang_load($locale, $domain); } - - -- cgit v1.2.1