Author: andyhot
Date: Sat Nov  4 03:49:48 2006
New Revision: 471168

URL: http://svn.apache.org/viewvc?view=rev&rev=471168
Log:
TAPESTRY-1136: Add a locale entry in djConfig

Modified:
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/AjaxShellDelegateTest.java

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?view=diff&rev=471168&r1=471167&r2=471168
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
 Sat Nov  4 03:49:48 2006
@@ -80,6 +80,7 @@
         
         dojoConfig.put("preventBackButtonFix", _preventBackButtonFix);
         dojoConfig.put("parseWidgets", _parseWidgets);
+        dojoConfig.put("locale", cycle.getPage().getLocale().toString());
         
         StringBuffer str = new StringBuffer("<script 
type=\"text/javascript\">");
         str.append("djConfig = ").append(dojoConfig.toString())

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/AjaxShellDelegateTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/AjaxShellDelegateTest.java?view=diff&rev=471168&r1=471167&r2=471168
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/AjaxShellDelegateTest.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/dojo/AjaxShellDelegateTest.java
 Sat Nov  4 03:49:48 2006
@@ -13,6 +13,8 @@
 // limitations under the License.
 package org.apache.tapestry.dojo;
 
+import java.util.Locale;
+import org.apache.tapestry.IPage;
 import static org.easymock.EasyMock.*;
 
 import org.apache.hivemind.Resource;
@@ -47,6 +49,13 @@
         expect(link.getAbsoluteURL()).andReturn("http://"; + path);
     }
     
+    void trainPageLocale(IRequestCycle cycle, Locale locale)
+    {
+        IPage page = newMock(IPage.class);        
+        expect(cycle.getPage()).andReturn(page);
+        expect(page.getLocale()).andReturn(locale);
+    }
+    
     public void test_Default_Render()
     {
         IAsset dojoSource = newAsset();
@@ -59,6 +68,8 @@
         
         trainStaticPath(assetService, dojoPath, "/dojo/path");
         
+        trainPageLocale(cycle, Locale.US);
+        
         trainStaticPath(assetService, dojoSource, "/dojo/path/dojo.js");
         
         trainStaticPath(assetService, tSource, "/tapestry/tapestry.js");
@@ -77,7 +88,7 @@
         
         assertBuffer("<script type=\"text/javascript\">djConfig = 
{\"isDebug\":false,"
                 + 
"\"debugAtAllCosts\":false,\"baseRelativePath\":\"http:///dojo/path\",";
-                +"\"preventBackButtonFix\":false,\"parseWidgets\":false} 
</script>\n" + 
+                
+"\"preventBackButtonFix\":false,\"parseWidgets\":false,\"locale\":\"en_US\"} 
</script>\n" + 
                 "\n" + 
                 " <script type=\"text/javascript\" 
src=\"http:///dojo/path/dojo.js\";></script>"
                 +"<script type=\"text/javascript\" 
src=\"http:///tapestry/tapestry.js\";></script>\n" + 
@@ -100,6 +111,8 @@
         
         trainStaticPath(assetService, dojoPath, "/dojo/path");
         
+        trainPageLocale(cycle, Locale.UK);
+        
         trainStaticPath(assetService, dojoSource, "/dojo/path/dojo.js");
         
         trainStaticPath(assetService, tSource, "/tapestry/tapestry.js");
@@ -120,7 +133,7 @@
         
         assertBuffer("<script type=\"text/javascript\">djConfig = 
{\"isDebug\":false,"
                 + 
"\"debugAtAllCosts\":false,\"baseRelativePath\":\"http:///dojo/path\",";
-                +"\"preventBackButtonFix\":false,\"parseWidgets\":false} 
</script>\n" + 
+                
+"\"preventBackButtonFix\":false,\"parseWidgets\":false,\"locale\":\"en_GB\"} 
</script>\n" + 
                 "\n" + 
                 " <script type=\"text/javascript\" 
src=\"http:///dojo/path/dojo.js\";></script>"
                 +"<script type=\"text/javascript\" 
src=\"http:///tapestry/tapestry.js\";></script>\n" + 


Reply via email to