Friday, August 15, 2014

R: Re: How to dynamically choose locale at SuperDevMode compile time?

Thanks! I'll give it a try as soon as I return at office. Did you consider contributing the gwt project with this patch?


Davide Cavestro


Aleš Pečnik <pecnikales@gmail.com> ha scritto:


I use meta tag in HTML for setting locale:
<meta name="gwt:property" content="locale=en" />

I use GWT from trunk, in Eclipse with -superDevMode argument, without bookmarklet. This patch works for me:

diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/dev_mode_on.js b/dev/codeserver/java/com/google/gwt/dev/codeserver/dev_mode_on.js
index 2964be7..9bb0a92 100644
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/dev_mode_on.js
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/dev_mode_on.js
@@ -380,6 +380,11 @@

     var url = url_prefix + '_callback=__gwt_bookmarklet_globals.callbacks.' +
         callback_id;
+    var nodelist=document.getElementsByTagName('meta');
+    for(var i=0; i<nodelist.length; i++) {
+        if(nodelist[i].getAttribute('name')=='gwt:property')
+            url+='&'+nodelist[i].getAttribute('content');
+    }

     var script = $doc.createElement('script');
     script.src = url;
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js
index 0b83ae6..bcb95de 100755
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js
@@ -202,6 +202,12 @@
     var compileScript = $doc.createElement('script');
     compileScript.src = serverUrl +
       '/recompile/__MODULE_NAME__?user.agent=' + ua + '&_callback=' + callback;
+    var nodelist=document.getElementsByTagName('meta');
+    for(var i=0; i<nodelist.length; i++) {
+        if(nodelist[i].getAttribute('name')=='gwt:property')
+            compileScript.src+='&'+nodelist[i].getAttribute('content');
+    }
+
     $head.appendChild(compileScript);
     compileButton.className = buttonClassName  + ' gwt-DevModeCompiling';
   }


--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/CJz8e_SyYTI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment