Author: [email protected]
Date: Wed Jun  3 20:45:12 2009
New Revision: 5505

Added:
    trunk/user/test/com/google/gwt/i18n/I18NTest_nb.gwt.xml
    trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test.java
     
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_nb.properties
     
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no.properties
     
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no_BOKMAL.properties
Modified:
    trunk/user/src/com/google/gwt/i18n/rebind/CurrencyListGenerator.java

Log:
Fix handling of generated filenames in CurrencyListGenerator
(don't force the locale name to its canonical form, which could
interfere with values found under the name of the canonical form).

Patch by: jat
Review by: andreasst (TBR)


Modified:  
trunk/user/src/com/google/gwt/i18n/rebind/CurrencyListGenerator.java
==============================================================================
--- trunk/user/src/com/google/gwt/i18n/rebind/CurrencyListGenerator.java        
 
(original)
+++ trunk/user/src/com/google/gwt/i18n/rebind/CurrencyListGenerator.java        
 
Wed Jun  3 20:45:12 2009
@@ -363,7 +363,7 @@

      String packageName = targetClass.getPackage().getName();
      String className = targetClass.getName().replace('.', '_') + "_"
-        + locale.getCanonicalForm().getAsString();
+        + locale.getAsString();
      PrintWriter pw = context.tryCreate(logger, packageName, className);
      if (pw != null) {
        ClassSourceFileComposerFactory factory = new  
ClassSourceFileComposerFactory(

Added: trunk/user/test/com/google/gwt/i18n/I18NTest_nb.gwt.xml
==============================================================================
--- (empty file)
+++ trunk/user/test/com/google/gwt/i18n/I18NTest_nb.gwt.xml     Wed Jun  3  
20:45:12 2009
@@ -0,0 +1,23 @@
+<!--                                                                         
-->
+<!-- Copyright 2009 Google  
Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License");  
you    -->
+<!-- may not use this file except in compliance with the License. You  
may   -->
+<!-- may obtain a copy of the License  
at                                    -->
+<!--                                                                         
-->
+<!--  
http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                         
-->
+<!-- Unless required by applicable law or agreed to in writing,  
software    -->
+<!-- distributed under the License is distributed on an "AS IS"  
BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express  
or        -->
+<!-- implied. License for the specific language governing permissions  
and   -->
+<!-- limitations under the  
License.                                         -->
+
+<module>
+       <!-- Inherit the JUnit support -->
+       <inherits name='com.google.gwt.junit.JUnit'/>
+       <inherits name = 'com.google.gwt.i18n.I18N'/>
+       <!-- Include client-side source for the test cases -->
+       <source path="client"/>
+       <extend-property name="locale" values="nb"/>
+       <set-property name = "locale" value = "nb"/>
+</module>

Added: trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test.java
==============================================================================
--- (empty file)
+++ trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test.java        Wed Jun 
 3  
20:45:12 2009
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2007 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may  
not
+ * use this file except in compliance with the License. You may obtain a  
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations  
under
+ * the License.
+ */
+package com.google.gwt.i18n.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.impl.CurrencyData;
+import com.google.gwt.i18n.client.impl.CurrencyList;
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests the Norwegian Bokmal locale.
+ */
+public class I18N_nb_Test extends GWTTestCase {
+
+  /**
+   * Test deprecated locale aliases with Messages.
+   */
+  public interface MyMessages extends Messages {
+    @DefaultMessage("default")
+    String nbLocale();
+
+    @DefaultMessage("default")
+    String noBokmalLocale();
+
+    @DefaultMessage("default")
+    String noLocale();
+  }
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.i18n.I18NTest_nb";
+  }
+
+  /**
+   * Test alias resolution.
+   */
+  public void testAliases() {
+    MyMessages msg = GWT.create(MyMessages.class);
+    assertEquals("nb", msg.nbLocale());
+    assertEquals("no_BOKMAL", msg.noBokmalLocale());
+    assertEquals("no", msg.noLocale());
+  }
+
+  /**
+   * Test currency codes.
+   */
+  public void testCurrency() {
+    CurrencyList currencyList = CurrencyList.get();
+    CurrencyData currencyData = currencyList.getDefault();
+    assertNotNull(currencyData);
+    assertEquals("NOK", currencyData.getCurrencyCode());
+    assertEquals("kr", currencyData.getCurrencySymbol());
+    currencyData = currencyList.lookup("RUB");
+    assertNotNull(currencyData);
+    assertEquals("RUB", currencyData.getCurrencyCode());
+    assertEquals("руб", currencyData.getCurrencySymbol());
+  }
+}

Added:  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_nb.properties
==============================================================================
--- (empty file)
+++  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_nb.properties
         
Wed Jun  3 20:45:12 2009
@@ -0,0 +1 @@
+nbLocale=nb

Added:  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no.properties
==============================================================================
--- (empty file)
+++  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no.properties
         
Wed Jun  3 20:45:12 2009
@@ -0,0 +1,3 @@
+nbLocale=no
+noBokmalLocale=no
+noLocale=no

Added:  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no_BOKMAL.properties
==============================================================================
--- (empty file)
+++  
trunk/user/test/com/google/gwt/i18n/client/I18N_nb_Test_MyMessages_no_BOKMAL.properties
  
Wed Jun  3 20:45:12 2009
@@ -0,0 +1,2 @@
+nbLocale=no_BOKMAL
+noBokmalLocale=no_BOKMAL

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to