From a1e4a6a16739196c58c18ae04327b637fb108ed9 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 3 Jul 2009 12:11:08 +0000 Subject: [PATCH] [tmf] compare structure of literal git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@570 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/operator/translate.php | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/messenger/webim/operator/translate.php b/src/messenger/webim/operator/translate.php index 0100e04f..16640aff 100644 --- a/src/messenger/webim/operator/translate.php +++ b/src/messenger/webim/operator/translate.php @@ -91,10 +91,25 @@ function save_message($locale,$key,$value) { } } +function get_auxiliary($s) { + $res = ""; + if(preg_match_all("/<[^>]+?>|[:]|\{\d+\}|[Mm]ibew|[Ww]ebim/", $s, $matches, PREG_PATTERN_ORDER)) { + foreach ($matches[0] as $val) { + if($val != "
") { + $res .= $val; + } + } + } + if(substr(trim($s),-1) == "." || substr(trim($s),-1) == "?") { + $res .= "."; + } + return $res; +} + $operator = check_login(); $source = verifyparam("source", "/^[\w-]{2,5}$/", $default_locale); -$target = verifyparam("target", "/^[\w-]{2,5}$/", $home_locale); +$target = verifyparam("target", "/^[\w-]{2,5}$/", $current_locale); $stringid = verifyparam("key", "/^[_\.\w]+$/", ""); if(!isset($messages[$source])) { @@ -166,7 +181,14 @@ if($show == 's1') { foreach($allkeys as $key) { if($key != 'output_charset') { $tsource = htmlspecialchars($lang1[$key]); - $value = isset($lang2[$key]) ? htmlspecialchars($lang2[$key]) : "absent"; + if(isset($lang2[$key])) { + $value = htmlspecialchars($lang2[$key]); + if(get_auxiliary($lang2[$key]) != get_auxiliary($lang1[$key])) { + $value = "$value (wrong formatting)"; + } + } else { + $value = "absent"; + } $result[] = array( 'id' => $key, 'l1' => $tsource,