### Eclipse Workspace Patch 1.0 #P org.eclipse.babel Index: server/html/js/projectString.js =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/js/projectString.js,v retrieving revision 1.26 diff -u -r1.26 projectString.js --- server/html/js/projectString.js 17 Nov 2008 19:05:07 -0000 1.26 +++ server/html/js/projectString.js 19 Nov 2008 18:17:07 -0000 @@ -204,7 +204,13 @@ updateStringTableCurrentTranslation: function(stringTableIndex,trans){ this.tableDom.rows[stringTableIndex].cells[1].innerHTML = trans; - } + }, + + updateStringTableFuzzy: function(stringTableIndex, fuzzy){ + if(fuzzy == 1) { + this.tableDom.rows[stringTableIndex].cells[1].innerHTML = '' + this.tableDom.rows[stringTableIndex].cells[1].innerHTML; + } + }, //$stringTableIndex }; @@ -232,10 +238,16 @@ values.string = "
"+temp+"
"; temp = this.data['translationString'] ? this.data['translationString'] : '' + + if(this.data['fuzzy'] == 1 && this.data['nontranslatable'] != 1) { + temp = "" + temp; + } + values.translation = "
"+temp+"
"; values.translator = this.data['translator'] ? this.data['translator'] : ''; values.createdon = this.data['createdOn']; values.stringname = this.data['stringname']; + values.fuzzy = this.data['fuzzy'] var lineDome = YAHOO.projectStringsManager.createHTML(values,tableDom); this.domElem = lineDome; Index: server/html/js/translation.js =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/js/translation.js,v retrieving revision 1.13 diff -u -r1.13 translation.js --- server/html/js/translation.js 2 Aug 2008 02:26:32 -0000 1.13 +++ server/html/js/translation.js 19 Nov 2008 18:17:07 -0000 @@ -83,6 +83,7 @@ function translationSumbit(allornot,translationIndex){ var target = document.getElementById('translation-form'); var tr_value = target.translation.value; + var fuzzy_value = (target.fuzzy_checkbox.checked ? 1 : 0); var callback = { @@ -91,6 +92,7 @@ success: function(o) { var response = eval("("+o.responseText+")"); YAHOO.projectStringsManager.updateStringTableCurrentTranslation(translationIndex, response.translationString); + YAHOO.projectStringsManager.updateStringTableFuzzy(translationIndex, fuzzy_value); target.innerHTML = response.translationArea; }, failure: function(o) { @@ -99,9 +101,9 @@ } YAHOO.tranlsation.posted = true; - var post = "string_id="+target.string_id.value+ "&translation="+sub(tr_value)+ + "&fuzzy="+fuzzy_value+ "&translate_action="+allornot; spin(); var request = YAHOO.util.Connect.asyncRequest('POST', "callback/setStringTranslation.php", callback, post); Index: server/html/callback/setStringTranslation.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/callback/setStringTranslation.php,v retrieving revision 1.22 diff -u -r1.22 setStringTranslation.php --- server/html/callback/setStringTranslation.php 17 Jul 2008 16:10:42 -0000 1.22 +++ server/html/callback/setStringTranslation.php 19 Nov 2008 18:17:07 -0000 @@ -17,6 +17,7 @@ $string_id = $App->getHTTPParameter("string_id", "POST"); $translation = $App->getHTTPParameter("translation", "POST"); +$fuzzy_state = $App->getHTTPParameter("fuzzy", "POST"); $language_id = $_SESSION["language"]; $project_id = $_SESSION['project']; @@ -54,6 +55,7 @@ language_id = '".addslashes($language_id)."', value = '".addslashes($translation)."', userid = '".addslashes($user_id)."', + possibly_incorrect = '".addslashes($fuzzy_state)."', created_on = NOW() "; $res = mysql_query($query,$dbh); @@ -119,6 +121,7 @@ language_id = '".addslashes($row['language_id'])."' , value = '".addslashes($translation)."', userid = '".addslashes($user_id)."', + possibly_incorrect = '".addslashes($fuzzy_state)."', created_on = NOW() "; $res2 = mysql_query($query,$dbh); @@ -153,6 +156,7 @@ string_id = '".addslashes($row['string_id'])."', language_id = '".addslashes($language)."' , value = '".addslashes($translation)."', + possibly_incorrect = '".addslashes($fuzzy_state)."', userid = '".addslashes($user_id)."', created_on = NOW() "; @@ -165,26 +169,28 @@ if(!$do_nothing) { # Find all string_id's that have the same binary value as the one we're translating # *and* have no translation yet, and update those too. - $sql = "SELECT s.string_id, COUNT(t.string_id) AS tr_count - FROM strings AS s - LEFT JOIN translations AS t ON t.string_id = s.string_id AND t.language_id = '".addslashes($language_id)."' - WHERE BINARY s.value = (select value from strings where string_id = '".addslashes($string_id)."') - AND s.is_active = 1 AND t.value IS NULL GROUP BY s.string_id HAVING tr_count = 0"; - - $res = mysql_query($sql, $dbh); - $str_count = mysql_affected_rows(); - - while($myrow = mysql_fetch_assoc($res)) { - $sql = "insert into - translations - set - string_id = " . $myrow['string_id'] . ", - language_id = '".addslashes($language_id)."', - value = '".addslashes($translation)."', - userid = '".addslashes($user_id)."', - created_on = NOW()"; - mysql_query($sql, $dbh); - $affected_rows += mysql_affected_rows(); + if(!$fuzzy_state) { + $sql = "SELECT s.string_id, COUNT(t.string_id) AS tr_count + FROM strings AS s + LEFT JOIN translations AS t ON t.string_id = s.string_id AND t.language_id = '".addslashes($language_id)."' + WHERE BINARY s.value = (select value from strings where string_id = '".addslashes($string_id)."') + AND s.is_active = 1 AND t.value IS NULL GROUP BY s.string_id HAVING tr_count = 0"; + + $res = mysql_query($sql, $dbh); + $str_count = mysql_affected_rows(); + + while($myrow = mysql_fetch_assoc($res)) { + $sql = "insert into + translations + set + string_id = " . $myrow['string_id'] . ", + language_id = '".addslashes($language_id)."', + value = '".addslashes($translation)."', + userid = '".addslashes($user_id)."', + created_on = NOW()"; + mysql_query($sql, $dbh); + $affected_rows += mysql_affected_rows(); + } } } Index: server/html/callback/getStringsforProject.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/callback/getStringsforProject.php,v retrieving revision 1.23 diff -u -r1.23 getStringsforProject.php --- server/html/callback/getStringsforProject.php 17 Nov 2008 19:05:57 -0000 1.23 +++ server/html/callback/getStringsforProject.php 19 Nov 2008 18:17:07 -0000 @@ -46,7 +46,8 @@ strings.value as string, strings.name as stringName, strings.non_translatable, - translations.value as translation + translations.value as translation, + translations.possibly_incorrect as fuzzy from strings, files @@ -70,6 +71,7 @@ strings.name as stringName, strings.non_translatable, translations.value as translation, + translations.possibly_incorrect as fuzzy, users.username as translator from strings, @@ -100,6 +102,7 @@ strings.value as text, strings.created_on as createdOn, translations.value as translationString, + translations.possibly_incorrect as fuzzy, users.first_name as first, users.last_name as last from @@ -154,7 +157,7 @@ if($line['non_translatable']){ $line['translationString'] = "non-translatable string"; $line['nontranslatable'] = true; - } + } $return[] = $line; $stringids[$line['stringId']] = 1; } Index: server/html/callback/getCurrentStringTranslation.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/callback/getCurrentStringTranslation.php,v retrieving revision 1.36 diff -u -r1.36 getCurrentStringTranslation.php --- server/html/callback/getCurrentStringTranslation.php 2 Aug 2008 02:03:59 -0000 1.36 +++ server/html/callback/getCurrentStringTranslation.php 19 Nov 2008 18:17:07 -0000 @@ -30,6 +30,7 @@ strings.non_translatable, strings.value as string_value, translations.value as translation_value, + translations.possibly_incorrect as fuzzy, files.name, strings.name as token, max(translations.version) @@ -149,8 +150,7 @@ Select some English text above to find similar translations. - >Non-Translatable - + >Non-Translatable
@@ -159,9 +159,13 @@ [Reset] [Clear] + -
+
+ > Translation is possibly incorrect +
+

Non Translatable String


@@ -178,16 +182,20 @@ "; + } print ""; print ""; print " +
"; - print "
".nl2br(htmlspecialchars($line['value']))."
"; + print "
$fuzzy".nl2br(htmlspecialchars($line['value']))."
"; print "
"; print $line['first_name']." ".$line['last_name']; Index: server/html/content/en_recent_html_list.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/content/en_recent_html_list.php,v retrieving revision 1.5 diff -u -r1.5 en_recent_html_list.php --- server/html/content/en_recent_html_list.php 12 Nov 2008 19:49:33 -0000 1.5 +++ server/html/content/en_recent_html_list.php 19 Nov 2008 18:17:07 -0000 @@ -18,6 +18,9 @@ li { padding-bottom: 5px; } +img { + vertical-align: bottom; +} @@ -31,9 +34,15 @@ $prev_date = substr($myrow['created_on'],0,10); echo "

$prev_date

"; } + $fuzzy = ""; + if($myrow['fuzzy'] == 1) { + $fuzzy = " "; + } + echo "
  • " . substr($myrow['created_on'],11,5) . " " . $myrow['string_value'] . - " -> " . $myrow['translation'] . + " -> " . $myrow['translation'] . + $fuzzy . " [" . $myrow['language'] . ": " .$myrow['string_key'] . "] " . $myrow['project_id'] . " " . $myrow['version'] . " Index: server/html/content/en_recent_html_common.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/content/en_recent_html_common.php,v retrieving revision 1.2 diff -u -r1.2 en_recent_html_common.php --- server/html/content/en_recent_html_common.php 21 Jul 2008 14:59:38 -0000 1.2 +++ server/html/content/en_recent_html_common.php 19 Nov 2008 18:17:07 -0000 @@ -34,10 +34,13 @@ + + translations
  • Layout value="1" /> Show Possibly Incorrect only
    \ No newline at end of file Index: server/html/recent.php =================================================================== RCS file: /cvsroot/technology/org.eclipse.babel/server/html/recent.php,v retrieving revision 1.8 diff -u -r1.8 recent.php --- server/html/recent.php 12 Nov 2008 19:49:33 -0000 1.8 +++ server/html/recent.php 19 Nov 2008 18:17:07 -0000 @@ -33,6 +33,12 @@ if($LANGUAGE_ID == "") { $LANGUAGE_ID = $_SESSION["language"]; } + +$FUZZY = $App->getHTTPParameter("fuzzy"); +if($FUZZY == "" || $FUZZY != 1) { + $FUZZY = 0; +} + if($LANGUAGE_ID == "All") { $LANGUAGE_ID = ""; } @@ -75,6 +81,9 @@ $where = $App->addAndIfNotNull($where) . "u.userid = "; $where .= $App->sqlSanitize($USERID, $dbh); } +if($FUZZY == 1) { + $where = $App->addAndIfNotNull($where) . "t.possibly_incorrect = 1 "; +} if($where != "") { $where = " WHERE " . $where; @@ -83,7 +92,8 @@ $sql = "SELECT s.name AS string_key, s.value as string_value, - t.value as translation, + t.value as translation, + t.possibly_incorrect as fuzzy, IF(u.last_name <> '' AND u.first_name <> '', CONCAT(CONCAT(first_name, ' '), u.last_name), IF(u.first_name <> '', u.first_name, u.last_name)) AS who,