r1352 - in branches/bxe_2_0: . js lang

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon Jul 25 12:55:13 2005
New Revision: 1352

Added:
   branches/bxe_2_0/js/i18n.js
   branches/bxe_2_0/lang/
   branches/bxe_2_0/lang/de.xml
   branches/bxe_2_0/lang/en.xml
Modified:
   branches/bxe_2_0/bxeLoader.js
   branches/bxe_2_0/js/bxeConfig.js
   branches/bxe_2_0/js/bxeFunctions.js
   branches/bxe_2_0/js/widget.js
Log:
addded i18n class and needed adjustements


Modified: branches/bxe_2_0/bxeLoader.js
==============================================================================
--- branches/bxe_2_0/bxeLoader.js	(original)
+++ branches/bxe_2_0/bxeLoader.js	Mon Jul 25 12:55:13 2005
@@ -49,6 +49,7 @@
 //mozile_js_files.push("mozile/mozileModify.js");
 mozile_js_files.push("js/eDOMEvents.js");
 mozile_js_files.push("js/bxeFunctions.js");
+mozile_js_files.push("js/i18n.js");
 
 
 var mozile_root_dir = "./";
@@ -230,6 +231,19 @@
 	}
 	td.load(xmlfile,callback);
 	
+	var tdlang = new mozileTransportDriver(bxe_config.xmlfile_method);
+	
+	function langcallback (e) {
+		if (e.isError) {
+			alert("Error loading language xml file \n"+e.statusText);
+			return false;
+		}
+		bxe_i18n = new i18n(e.document);
+
+		
+	}
+	tdlang.load(bxe_config.langfile,langcallback);
+	
 	return true;
 }
 

Modified: branches/bxe_2_0/js/bxeConfig.js
==============================================================================
--- branches/bxe_2_0/js/bxeConfig.js	(original)
+++ branches/bxe_2_0/js/bxeConfig.js	Mon Jul 25 12:55:13 2005
@@ -65,6 +65,8 @@
 	bxe_config.xslfile = bxe_config.getContent("/config/files/input/file[@name='BX_xslfile']");
 	bxe_config.xhtmlfile = bxe_config.getContent("/config/files/input/file[@name='BX_xhtmlfile']");
 	bxe_config.validationfile = bxe_config.getContent("/config/files/input/file[@name='BX_validationfile']");
+	bxe_config.langfile = bxe_config.getContent("/config/files/input/file[@name='BX_langfile']");
+	
 	bxe_config.exitdestination = bxe_config.getContent("/config/files/output/file[@name='BX_exitdestination']");
 	
 	bxe_config.cssfiles = bxe_config.getContentMultiple("/config/files/css/file");

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Mon Jul 25 12:55:13 2005
@@ -650,7 +650,7 @@
 		menui.MenuPopup._node = node._node;
 	}
 
-	popup.addMenuItem("Copy "  + node.vdom.bxeName  + " Element", function (e) {
+	popup.addMenuItem(bxe_i18n.getText("Copy {0} Element", new Array(node.vdom.bxeName)), function (e) {
 		var widget = e.currentTarget.Widget;
 		var delNode = widget.MenuPopup.MainNode;
 		delNode.copy();

Added: branches/bxe_2_0/js/i18n.js
==============================================================================
--- (empty file)
+++ branches/bxe_2_0/js/i18n.js	Mon Jul 25 12:55:13 2005
@@ -0,0 +1,23 @@
+function i18n (xml) {
+
+	this.xml = xml;
+	
+}
+
+
+i18n.prototype.getText = function (key, replacements) {
+	var res = this.xml.evaluate("/catalogue/message[@key='"+key+"']/text()", this.xml, null, 
+	 XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue;
+	if ( res ) {
+		var string = res.nodeValue;
+	} else {
+		var string = key;
+	}
+	
+	if (replacements) {
+		 string = eval("'"+string.replace(/\{([0-9]+)\}/g,"'+replacements[$1]+'") + "'");
+		 
+	}
+	
+	return string;
+}
\ No newline at end of file

Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js	(original)
+++ branches/bxe_2_0/js/widget.js	Mon Jul 25 12:55:13 2005
@@ -695,7 +695,7 @@
 
 		eDOMEventCall("ContextPopup",node,this.Popup);
 		
-		this.Popup.addSeparator(" Append ");
+		this.Popup.addSeparator(bxe_i18n.getText(" Append "));
 		this.Popup.appendAllowedSiblings(node,this.subPopup);
 		
 		this.Popup.draw();
@@ -786,7 +786,7 @@
 	} 
 	
 	this.Popup._node = node;
-	this.Popup.addSeparator(" Append to ");
+	this.Popup.addSeparator(bxe_i18n.getText(" Append to "));
 	node = nodeX;
 	
 	//parent nodes

Added: branches/bxe_2_0/lang/de.xml
==============================================================================
--- (empty file)
+++ branches/bxe_2_0/lang/de.xml	Mon Jul 25 12:55:13 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<catalogue >
+
+
+<message key=" Append to "> Füge zu </message> 
+<message key="Copy {0} Element">Kopiere {0} Element</message>
+</catalogue>

Added: branches/bxe_2_0/lang/en.xml
==============================================================================
--- (empty file)
+++ branches/bxe_2_0/lang/en.xml	Mon Jul 25 12:55:13 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<catalogue >
+
+
+</catalogue>
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.