From 6a182ca93280bf14e233fe785b39b6707e89ef0b Mon Sep 17 00:00:00 2001
From: gnaegi <none@none>
Date: Thu, 8 Aug 2013 08:56:04 +0200
Subject: [PATCH] non-jira: fix js errors in translation tool due to
 prototype->jquery migration, adding some i18n keys

---
 .../_content/translationToolI18nItemEdit.html | 25 ++++++++++++-------
 .../i18n/ui/_i18n/LocalStrings_de.properties  |  1 +
 .../i18n/ui/_i18n/LocalStrings_en.properties  |  1 +
 .../ui/edit/_i18n/LocalStrings_en.properties  |  3 ++-
 .../qpool/ui/_i18n/LocalStrings_en.properties |  4 +--
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/olat/core/util/i18n/ui/_content/translationToolI18nItemEdit.html b/src/main/java/org/olat/core/util/i18n/ui/_content/translationToolI18nItemEdit.html
index 5e9ed1f67fc..e4ba5a82652 100644
--- a/src/main/java/org/olat/core/util/i18n/ui/_content/translationToolI18nItemEdit.html
+++ b/src/main/java/org/olat/core/util/i18n/ui/_content/translationToolI18nItemEdit.html
@@ -47,7 +47,8 @@
 			<div class="b_translation_refKey b_float_right b_with_small_icon_left" style="display: none" onclick="this.style.display='none'">
 				<code></code> = <span></span>
 			</div>
-			<h5 class="b_with_small_icon_left b_flag_$targetLanguageKey">$r.translate("generic.${customizingPrefix}lang.target"): $targetLanguage</h5>	
+			<a href="#top" onclick="copyFromReference();" class="b_button b_xsmall b_float_right"><span>$r.translate('copy')</span></a>
+			<h5 class="b_with_small_icon_left b_flag_$targetLanguageKey">$r.translate("generic.${customizingPrefix}lang.target"): $targetLanguage</h5>
 			$r.render("targetArea")
 		</div>		
 		<div class="b_button_group">
@@ -69,8 +70,8 @@
 //FIXME:FG:6.2: Implement Java way of setting flexi form link buttons dirty on change
 function b_SetTranslationSaveLinksDirty() {
 	var save=jQuery("#$f.getItemId("saveLink")"); 
-	if (!save.hasClassName('b_button_dirty')) {
-		save.addClassName('b_button_dirty'); 
+	if (!save.hasClass('b_button_dirty')) {
+		save.addClass('b_button_dirty'); 
 		#if ($hasNext) 
 			jQuery("#$f.getItemId("saveNextLink")").addClass('b_button_dirty');
 		#end
@@ -90,7 +91,7 @@ function checkClick(wrapperName, langCode) {
 	## Get content from text area within this wrapper
 	var area = jQuery('div.' + wrapperName + ' textarea')[0];
 	var cursorPos = area.selectionStart;
-	var content = area.getValue();
+	var content = area.value;
 	## Find the start position of the next i18n reference supported style:
 	var counter = 0;
 	while (content.indexOf("$") != -1 && counter < 10) {
@@ -99,10 +100,10 @@ function checkClick(wrapperName, langCode) {
 		if (startPos <= cursorPos && endPos >= cursorPos) {
 			var reference = content.substring(startPos, endPos);
 			## remove {wrapper} brakes
-			if (reference.startsWith("{")) reference = reference.substring(1, reference.length-1);			
+			if (reference.match("^\{")) reference = reference.substring(1, reference.length-1);			
 			var bundleName = "";
 			var key = "";
-			if (reference.startsWith(":")) {
+			if (reference.match("^:")) {
 				## of type ':my.key' - get current bundle from bundles selction dropdown
 				key = reference.substring(1, reference.length);	
 				var select = jQuery("#bundlesSelectionContainer select")[0];
@@ -119,9 +120,9 @@ function checkClick(wrapperName, langCode) {
 				var translated = trans.translate(key);
 				if (translated != reference) {
 					## set new key and value, make element visible
-					jQuery('div.' + wrapperName + ' div.b_translation_refKey code')[0].update(reference);
-					jQuery('div.' + wrapperName + ' div.b_translation_refKey span')[0].update(translated);
-					jQuery('div.' + wrapperName + ' div.b_translation_refKey')[0].setStyle('display: inline');
+					jQuery('div.' + wrapperName + ' div.b_translation_refKey code').html(reference);
+					jQuery('div.' + wrapperName + ' div.b_translation_refKey span').html(translated);
+					jQuery('div.' + wrapperName + ' div.b_translation_refKey').css('display: inline');
 				}
 			}
 			break;
@@ -134,6 +135,12 @@ function checkClick(wrapperName, langCode) {
 	}	
 }
 	
+## Method to copy the text from the reference language to the target language
+function copyFromReference() {
+	var refVal = jQuery('.b_translation_edit_reference textarea').val();
+	jQuery('.b_translation_edit_target textarea').val(refVal);	
+}
+	
 ## Initialize observers
 jQuery(function() {
 	jQuery('div.b_translation_edit_reference textarea').each(function(index, el) {
diff --git a/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_de.properties
index ffac783fdf2..6d8291522bc 100644
--- a/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_de.properties
+++ b/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_de.properties
@@ -4,6 +4,7 @@ cache.flush=Cache leeren
 cache.flush.ok=Der Cache wurde geleert.
 cache.intro=Dr\u00FCcken Sie auf "Cache leeren" wenn Ihre \u00DCbersetzungen im GUI nicht automatisch angezeigt werden. Wenn Sie OLAT mit einem lokalen Texteditor \u00FCbersetzen, muss ebenfalls der Cache gel\u00F6scht werden damit Ihre \u00DCbersetzungen aktiv werden.
 cache.title=\u00DCbersetzungscache
+copy=Referezsprache kopieren
 configuration.default.lang.must.be.enabed=Die Standardsprache "{0}"ann nicht deaktiviert werden.
 configuration.defaultLangSelection=Standardsprache
 configuration.defaultLangSelection.intro=Die Standardsprache wird auf der OLAT Loginseite sowie bei neu erstellten Benutzerkonten verwendet.
diff --git a/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_en.properties
index 7a3562d53b0..fbd415664e3 100644
--- a/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/core/util/i18n/ui/_i18n/LocalStrings_en.properties
@@ -4,6 +4,7 @@ cache.flush=Empty cache
 cache.flush.ok=Cache emptied.
 cache.intro=Click on "Empty cache" if your translation is not automatically displayed in the GUI. When translating OpenOLAT by means of a local text editor you will also have to empty your cache to activate your translations.
 cache.title=Translation cache
+copy=Copy from reference
 configuration.default.lang.must.be.enabed=The standard language "{0}" must be activated.
 configuration.defaultLangSelection=Standard language
 configuration.defaultLangSelection.intro=This standard language is used on the OpenOLAT login page as well as when creating new user accounts.
diff --git a/src/main/java/org/olat/group/ui/edit/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/group/ui/edit/_i18n/LocalStrings_en.properties
index aca6760e486..5844699260e 100644
--- a/src/main/java/org/olat/group/ui/edit/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/group/ui/edit/_i18n/LocalStrings_en.properties
@@ -1,4 +1,4 @@
-#Fri Feb 01 13:48:31 CET 2013
+#Thu Aug 08 08:49:27 CEST 2013
 add.member=$org.olat.group.ui.main\:add.member
 areachoice.no.areas.admin=No learning areas found. Please create a learning area within your group management.
 areachoice.no.areas.owner=No learning areas found. New learning areas can only be created by users who have access to the entire group management.
@@ -121,6 +121,7 @@ table.header.lastName=$org.olat.group.ui.main\:table.header.lastName
 table.header.lastTime=$org.olat.group.ui.main\:table.header.lastTime
 table.header.login=$org.olat.group.ui.main\:table.header.login
 table.header.mail=$org.olat.group.ui.main\:table.header.mail
+table.header.online=$org.olat.group.ui.main\:table.header.online
 table.header.participants=$org.olat.group.ui.main\:table.header.participants
 table.header.participantsCount=$org.olat.group.ui.main\:table.header.participantsCount
 table.header.remove=$org.olat.group.ui.main\:table.header.remove
diff --git a/src/main/java/org/olat/modules/qpool/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/qpool/ui/_i18n/LocalStrings_en.properties
index f6fb1ed8c2e..1020fc5415e 100644
--- a/src/main/java/org/olat/modules/qpool/ui/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/modules/qpool/ui/_i18n/LocalStrings_en.properties
@@ -154,6 +154,6 @@ import.file=Import file
 import.failed=Questions has not been imported.
 import.success={0} questions has been imported.
 create.success=1 question has been created.
-error.input.toolong=Leider ist Ihr gerade eingegebener Text mit {1} Zeichen zu lang. Bitte beschr\u00E4nken Sie sich auf maximal {0} Zeichen.
-share.options=Wollen Sie anderen Personen erlauben diese Frage(n) zu bearbeiten?
+error.input.toolong=The text you entered is to long ({1} characters). Only {1} characters are allowed.
+share.options=Do you want to allow another person to edit this/these question(s)? 
 share.editable=Edit
\ No newline at end of file
-- 
GitLab