[225894] Ability to take over English translation with one click
diff --git a/html/babel.css b/html/babel.css
index 0676aa2..426a77c 100644
--- a/html/babel.css
+++ b/html/babel.css
@@ -178,9 +178,7 @@
background-color: SteelBlue;
font-weight: bold;
}
-#title-link,
-#string-area a,
-#translation-area a {
+#title-link a{
font-size: 9pt;
color: white;
background-color: SteelBlue;
diff --git a/html/callback/getCurrentStringTranslation.php b/html/callback/getCurrentStringTranslation.php
index a95b88d..4422807 100644
--- a/html/callback/getCurrentStringTranslation.php
+++ b/html/callback/getCurrentStringTranslation.php
@@ -137,7 +137,10 @@
<input type="hidden" name="stringTableIndex" value="<?=$stringTableIndex;?>">
<div id="english-area" class="side-component">
- <h4>English String</h4>
+ <h4>
+ English String
+ [<a id="copy-english-string-link">Copy</a>]
+ </h4>
<div style='overflow: auto; height: 80px;'>
<b><?= htmlspecialchars(nl2br($line['string_value']));?></b>
</div>
@@ -151,8 +154,12 @@
</div>
<div id="translation-textarea" class="side-component">
<?if($line['non_translatable'] == 0){?>
- <h4>Current Translation</h4>
- <textarea style='display: inline; width: 320px; height: 150px;' name="translation"><?=(($line['translation_value']));?></textarea>
+ <h4>
+ Current Translation
+ [<a id="reset-current-translation-link">Reset</a>]
+ [<a id="clear-current-translation-link">Clear</a>]
+ </h4>
+ <textarea id="current-translation" style='display: inline; width: 320px; height: 150px;' name="translation"><?=(($line['translation_value']));?></textarea>
<br>
<button id="allversions" type="submit" name="translateAction" value="All Versions">Submit</button>
<?}else{?>
diff --git a/html/js/projectString.js b/html/js/projectString.js
index ce89773..c9ce759 100644
--- a/html/js/projectString.js
+++ b/html/js/projectString.js
@@ -68,7 +68,8 @@
var ntDomNode = document.getElementById('not-translated');
this.sp.tableDom = document.createElement("table")
- this.sp.tableDom.className = "translatable ";
+ this.sp.tableDom.id = "strings-in-file-table";
+ this.sp.tableDom.className = "translatable";
this.sp.tableDom.cellSpacing = 0;
this.sp.tableDom.width = "100%"
ntDomNode.innerHTML = "";
diff --git a/html/js/translation.js b/html/js/translation.js
index 196fd48..370e188 100644
--- a/html/js/translation.js
+++ b/html/js/translation.js
@@ -37,6 +37,9 @@
YAHOO.util.Event.addListener("allversions","click",translateAll);
YAHOO.util.Event.addListener("translation-form","submit",translationSumbitStop);
YAHOO.util.Event.addListener("non-translatable-checkbox","click",notTranslatable);
+ YAHOO.util.Event.addListener("copy-english-string-link","click",copyEnglishString);
+ YAHOO.util.Event.addListener("reset-current-translation-link","click",resetCurrentTranslation);
+ YAHOO.util.Event.addListener("clear-current-translation-link","click",clearCurrentTranslation);
}
@@ -113,3 +116,21 @@
var domNode = document.getElementById('translation-form');
YAHOO.spinable.attach(domNode);
}
+
+function copyEnglishString() {
+ var stringsInFileTable = document.getElementById('strings-in-file-table');
+ var stringTableIndex = document.getElementById('translation-form').stringTableIndex.value;
+ var englishString = stringsInFileTable.rows[stringTableIndex].cells[0].textContent;
+ var currentTranslation = document.getElementById('current-translation');
+ currentTranslation.value = currentTranslation.value + englishString;
+}
+
+function resetCurrentTranslation() {
+ var currentTranslation = document.getElementById('current-translation');
+ currentTranslation.value = currentTranslation.defaultValue;
+}
+
+function clearCurrentTranslation() {
+ var currentTranslation = document.getElementById('current-translation');
+ currentTranslation.value = "";
+}
diff --git a/html/js/translationHint.js b/html/js/translationHint.js
index bfa3ef5..e93f75b 100644
--- a/html/js/translationHint.js
+++ b/html/js/translationHint.js
@@ -19,7 +19,7 @@
domNode.innerHTML = o.responseText;
var domNode = document.getElementById('translation-hints-title');
- domNode.innerHTML = "Translation Hints [<a id=\"clear-btn\"href=\"javascript:void(0);\">clear</a>]";
+ domNode.innerHTML = "Translation Hints [<a id=\"clear-btn\"href=\"javascript:void(0);\">Clear</a>]";
},
failure: function(o) {
YAHOO.log('failed!');