cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r502204 - in /cocoon: branches/BRANCH_2_1_X/ trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/ trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/...
Date Thu, 01 Feb 2007 12:53:01 GMT
Author: bruno
Date: Thu Feb  1 04:53:00 2007
New Revision: 502204

URL: http://svn.apache.org/viewvc?view=rev&rev=502204
Log:
CForms: change some things now that I have a better understanding of the dojo locale things:
 - dojo works best with one default locale for the whole page, set this locale via djConfig.locale,
taken from a sitemap parameter.
 - don't use dojo.extraLocales
 - leave the locale attribute on the form tag there to be able to provide helpful debugging
in datetime picker widget

Modified:
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=502204&r1=502203&r2=502204
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Thu Feb  1 04:53:00 2007
@@ -190,6 +190,7 @@
     </action>
     <action dev="BRD" type="update">
       CForms: introduce a new dojo-based popup-picker for dates, times and datetimes.
+      For correct localization, supply a "dojo-locale" parameter to the forms styling XSLT
(see samples).
     </action>
     <action dev="BRD" type="add">
       CForms: add support for a "timeStyle" attribute on the formatting date convertor, so

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl?view=diff&rev=502204&r1=502203&r2=502204
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-field-styling.xsl
Thu Feb  1 04:53:00 2007
@@ -28,7 +28,19 @@
                 exclude-result-prefixes="fi">
 
   <xsl:param name="dojo-debug">false</xsl:param><!-- option to turn on console
debugging for dojo on the browser, from a parameter in the sitemap -->
-  <xsl:param name="dojo-languages">["en", "de", "nl", "fr", "it", "pt"]</xsl:param>
<!-- Allows to configure the dojo languages from a parameter in the sitemap. This should
be a valid javascript array. -->
+  <xsl:param name="dojo-locale">en</xsl:param> <!-- Allows to configure the
dojo locale from a parameter in the sitemap. This should be the same as the form locale. -->
+
+  <!-- Create a variable with the normalized locale, dojo needs locale parts to be separated
with a dash -->
+  <xsl:variable name="dojoLocale">
+    <xsl:choose>
+      <xsl:when test="$dojo-locale != ''">
+        <xsl:value-of select="translate($dojo-locale, '_', '-')"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>en</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
 
   <!--+
       | Setup the scripts for CForms
@@ -65,7 +77,7 @@
       <xsl:if test="$dojo-debug = 'true'">                                        
  <!-- turn on debugging, if requested -->
         <xsl:text> djConfig.isDebug = true; </xsl:text>
       </xsl:if>
-      djConfig.extraLocale = <xsl:value-of select="$dojo-languages"/>;
+      djConfig.locale = "<xsl:value-of select="$dojoLocale"/>";
       var cocoon;
       if (!cocoon)
         cocoon = {};

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js?view=diff&rev=502204&r1=502203&r2=502204
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
Thu Feb  1 04:53:00 2007
@@ -60,10 +60,11 @@
                     this.locale = formLocale;
             }
 
-            // make sure locale is supported by dojo, otherwise fall back to 'en'
-            if (this.locale == null || this.locale == "" || !djConfig.extraLocale || !dojo.lang.inArray(djConfig.extraLocale,
this.locale.split("-")[0])) {
-                dojo.debug("DropdownDateTimePicker: no locale specified or locale used by
widget or CForm (" + this.locale + ") is not loaded via djConfig.extraLocale, will fall back
to 'en'.");
+            this.locale = dojo.locale;
+            if (this.locale == null)
                 this.locale = "en";
+            if (this.locale != formLocale) {
+                dojo.debug("DropdownDateTimePicker: form locale (" + formLocale + ") is different
from dojo locale (" + dojo.locale + ")")
             }
 
             this._splitPattern();

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=502204&r1=502203&r2=502204
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap
Thu Feb  1 04:53:00 2007
@@ -218,6 +218,7 @@
        </map:call>
        <map:transform src="resources/forms-samples-styling.xsl">
          <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/>
+         <map:parameter name="dojo-locale" value="{flow-attr:locale}"/>
        </map:transform>
        <map:transform type="i18n">
        </map:transform>
@@ -240,7 +241,8 @@
        </map:call>
        <map:transform src="resources/forms-samples-styling.xsl">
          <map:parameter name="resources-uri" value="{request:contextPath}/_cocoon/resources"/>
-         <map:parameter name="dojo-debug" value="false"/><!-- set to true to turn
on dojo debugging in the Browser -->
+         <map:parameter name="dojo-debug" value="true"/><!-- set to true to turn
on dojo debugging in the Browser -->
+         <map:parameter name="dojo-locale" value="{flow-attr:locale}"/>
        </map:transform>
        <map:transform type="i18n">
          <map:parameter name="locale" value="{flow-attribute:locale}"/>



Mime
View raw message