Author: chregu
Date: Fri Jul 29 11:38:28 2005
New Revision: 1361
Modified:
branches/bxe_2_0/bxeLoader.js
branches/bxe_2_0/js/i18n.js
Log:
make langfile option optional
Modified: branches/bxe_2_0/bxeLoader.js
==============================================================================
--- branches/bxe_2_0/bxeLoader.js (original)
+++ branches/bxe_2_0/bxeLoader.js Fri Jul 29 11:38:28 2005
@@ -231,19 +231,22 @@
}
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);
+ if (bxe_config.langfile) {
+ 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);
+ } else {
+ bxe_i18n = new i18n(null);
}
- tdlang.load(bxe_config.langfile,langcallback);
-
return true;
}
Modified: branches/bxe_2_0/js/i18n.js
==============================================================================
--- branches/bxe_2_0/js/i18n.js (original)
+++ branches/bxe_2_0/js/i18n.js Fri Jul 29 11:38:28 2005
@@ -1,28 +1,30 @@
function i18n (xml) {
this.xml = xml;
-
}
i18n.prototype.getText = function (key, replacements) {
- try {
-
- 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;
+ if (this.xml) {
+ try {
+ 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;
+ }
+ } catch (e) {
+ alert(e + "\n Used key: " + key );
+ }
} else {
- var string = key;
- }
- } catch (e) {
- alert(e + "\n Used key: " + key );
+ string = key;
}
if (replacements) {
- string = eval("'"+string.replace(/\{([0-9]+)\}/g,"'+replacements[$1]+'") + "'");
-
+ string = eval("'"+string.replace(/\{([0-9]+)\}/g,"'+replacements[$1]+'") + "'");
+
}
return string;
--
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.