[Sciviews-commits] r239 - in komodo/SciViews-K: . content content/js

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 28 16:25:21 CET 2009


Author: phgrosjean
Date: 2009-12-28 16:25:20 +0100 (Mon, 28 Dec 2009)
New Revision: 239

Modified:
   komodo/SciViews-K/content/js/interpolate.js
   komodo/SciViews-K/content/js/sciviews.js
   komodo/SciViews-K/content/pref-R.xul
   komodo/SciViews-K/sciviewsk-0.9.9-ko.xpi
Log:
Adding features to tag translatable strings in snippets using [[%tr:translatable string]] and in macros using _("translatable string") (this is for project and toolbox items where usual string translation is not applicable). Also, minor changes to pref-R.xul.

Modified: komodo/SciViews-K/content/js/interpolate.js
===================================================================
--- komodo/SciViews-K/content/js/interpolate.js	2009-12-27 19:26:36 UTC (rev 238)
+++ komodo/SciViews-K/content/js/interpolate.js	2009-12-28 15:25:20 UTC (rev 239)
@@ -53,7 +53,16 @@
     var lastErrorSvc = Components.classes["@activestate.com/koLastErrorService;1"]
                        .getService(Components.interfaces.koILastErrorService);
 
-    // Interpolation step 1: get queries.
+    // PhG: interpolation step 0: eliminate [[%tr:...]] used to tag strings
+	// to be translated
+	var brStr = bracketedStrings[0];
+	// Replace [[%tr:some string]] by some string
+	brStr = brStr.replace(/\[\[%tr:([^\]\]]+)\]\]/g, "$1");
+	// Replace [[%ask:x:%tr:x-value]] by [[%ask:x:x-value]]
+	brStr = brStr.replace(/%tr:/g, "");
+	bracketedStrings[0] = brStr;
+	
+	// Interpolation step 1: get queries.
     var queriesCountObj = new Object();
     var queriesObj = new Array();
     var i1countObj = new Object();

Modified: komodo/SciViews-K/content/js/sciviews.js
===================================================================
--- komodo/SciViews-K/content/js/sciviews.js	2009-12-27 19:26:36 UTC (rev 238)
+++ komodo/SciViews-K/content/js/sciviews.js	2009-12-28 15:25:20 UTC (rev 239)
@@ -3,6 +3,9 @@
 // Copyright (c) 2008-2009, Ph. Grosjean (phgrosjean at sciviews.org)
 // License: MPL 1.1/GPL 2.0/LGPL 2.1
 ////////////////////////////////////////////////////////////////////////////////
+// _(); // A fake function used only to tag strings to be translated in projects
+//         and toolbox macros
+//
 // sv.version; // Get current SciViews-K version (major.minor.release)
 // sv.showVersion; // Do we display version in an alert() box or just set it?
 // sv.checkVersion(version); // Check the SciViews-K extension version is fine
@@ -47,8 +50,9 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
+// This function is used to tag strings to be translated in projects/toolbox
+_ = function(str) { return(str) }
 
-
 if (typeof(sv) == 'undefined') sv = {};
 
 // Create the 'sv.tools' namespace

Modified: komodo/SciViews-K/content/pref-R.xul
===================================================================
--- komodo/SciViews-K/content/pref-R.xul	2009-12-27 19:26:36 UTC (rev 238)
+++ komodo/SciViews-K/content/pref-R.xul	2009-12-28 15:25:20 UTC (rev 239)
@@ -199,7 +199,7 @@
 		</grid>
 	</groupbox>
 	<groupbox orient="vertical">
-		<caption label="Data output"/>
+		<caption label="Data input and output"/>
 		<grid>
 		<columns>
 			<column flex="3"/> <column flex="3"/> <column flex="3"/>
@@ -214,9 +214,12 @@
 					</menulist>
 
 					<label value="CSV field separator" control="r.csv.sep" />
+
+							  <!--PhG: this raises an error when included in the <menulist ...> tag hereunder! oninput="this.value = this.value[0];"-->
+
 					<menulist pref="true" id="r.csv.sep"
 							  editable="true"
-							  <!--oninput="this.value = this.value[0];"-->
+
 							  onkeyup="if (event.keyCode == 13) editMenulist(this);"
 							  onblur="editMenulist(this);"
 							  values=", ; \t" persist="values"

Modified: komodo/SciViews-K/sciviewsk-0.9.9-ko.xpi
===================================================================
(Binary files differ)



More information about the Sciviews-commits mailing list