Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    Originally posted by Isomorphic View Post
    That all said, this is an incomplete test case (no SQL Schema, no resource bundle), but since you're having so much trouble here, we'll make the mods necessary to the sample project and show you what an appropriate test case would look like (dead simple, and easier than what you've done).
    That would be very kind of you. Thanks in advance.
    Note: with sqlschema and resource bundles (+gwt.xml) it's pretty much what was included in the project I wanted to send you

    Now our project is close to a deadline, I'd really appreciate progressing in the resolution of this issue. Let me know asap if you are able to reproduce or if you still miss something.

    Regards
    Antoine

    Comment


      #17
      With your test case, which of your validators are showing duplicate and/or wrong locale error messages?

      You have a required="true" declaration, which implicitly is a validator of type="required". It has no errorMessage defined, so it will show the framework default message. That will still be localized if you have set the GWT locale of course.

      Comment


        #18
        Hi

        See my last screenshot. Both 'required' validators are showing duplicate localizations.
        In my test case, and in our application, we have enabled fr and en locales in gwt.xml.
        I reproduce the problem when setting locale to french (query parameter locale=fr or meta tag gwt:property to fr). I shows 'Field is required' and 'Champ requis' in the same tooltip

        Antoine

        Comment


          #19
          This starts getting critical for us, we had to move to a recent build to have some other tickets solved and we are now facing a couple of regressions. As the application is fully localized, this is big concern and we would really appreciate it can be solved asap in a stable release.

          Regards,

          Th. Gilbert

          Comment


            #20
            Hi Th. Gilbert,
            Please rest assured we are working on this and will follow up as soon as we have more information

            Regards
            Isomorphic Software

            Comment


              #21
              Just a follow up to let you know we are reproducing the problem and a developer is working on a solution. We anticipate being able to get a framework change in to address this very soon.

              Regards
              Isomorphic Software

              Comment


                #22
                Hi,
                After some investigation, it turns out things are actually behaving as they should in our testing, and problem you're experiencing is most likely a configuration error. We apologize for the conflicting information.

                To show you a test case where this is behaving as it should - let's start with the "BuiltInDS" sample from the SmartGWTEE 4.1p package.
                For completeness, let's show both framework localization and localization of custom values within the .ds.xml file - in this case the error message for a validator.

                Everything we're doing here is covered in the javadoc - see the Framework localization overview and the DataSource localization overview. (We're not getting into other application-level localization, but for completeness we recommend standards GWT localization techniques as discussed here)

                To start with let's modify the BuiltInDS application to enable framework localization:
                - modify the BuiltInDS.gwt.xml file to enable the "fr" locale as follows:
                Code:
                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
                   "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
                <module rename-to="builtinds">
                    <inherits name='com.google.gwt.user.User'/>
                    <inherits name="com.smartgwt.tools.SmartGwtTools"/>
                    <inherits name="com.smartgwtee.tools.Tools"/>
                    <inherits name="com.smartgwtee.SmartGwtEE"/>
                    <entry-point class='com.smartgwt.sample.client.BuiltInDS'/>
                    <extend-property name="locale" values="fr"/>
                </module>
                Now you can either add the "locale=fr" param to your browser when loading the app: http://127.0.0.1:8888/BuiltInDS.html?locale=fr, or you can add the meta tag to your bootstrap's source: <meta name="gwt:property" content="locale=fr">

                Now if you load the application, you'll see the empty message before you select a DataSource from the grid on the left is localized to French.
                If you select "Office Supplies" and then click the "New" button, followed by the "Save" button without entering any details, you'll see the validation error displayed next to the "Item" item is localized ("Champs Requis" rather than "Field is Required").

                Now lets add a validator to the xml file with a custom error message, and localize that:
                - create a new pair of .properties files in your source tree.
                We created "i18nMessages.properties", containing the following:
                Code:
                #custom properties file for 'i18nMessages'
                validator_requiredField = Required Field Custom
                and "i18nMessages_fr.properties", containing this:
                Code:
                #custom properties file for 'i18nMessages' - french version
                validator_requiredField = Champs Requis Personnailise
                You can put these wherever makes sense for your app - we put them in the com.smartgwt.sample.client package.

                Now modify the supplyItem.ds.xml file to include the "fmt" tags necessary to pick up this locale information. Note the <fmt:bundle... > tag refers to the correct location for the localized files:
                Code:
                <DataSource  xmlns:fmt="WEB-INF/"
                    ID="supplyItem"
                    serverType="sql"
                    tableName="supplyItem"
                    titleField="itemName"
                    testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
                    dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
                >
                	<fmt:bundle basename="com.smartgwt.sample.client.i18nMessages" />
                    
                    <fields>
                        <field name="itemID"      type="sequence" hidden="true"       primaryKey="true"/>
                        <field name="itemName"    type="text"     title="Item"        length="128">
                            <validators>
                                <validator type="required" requiresServer="true">
                                    <errorMessage><fmt:message key="validator_requiredField"/>
                                    </errorMessage>
                                </validator>
                            </validators>
                        </field>
                        <field name="SKU"         type="text"     title="SKU"         length="10"        required="true"/>
                        <field name="description" type="text"     title="Description" length="2000"/>
                        <field name="category"    type="text"     title="Category"    length="128"       required="true"
                               foreignKey="supplyCategory.categoryName"/>
                        <field name="units"       type="enum"     title="Units"       length="5">
                            <valueMap>
                                <value>Roll</value>
                                <value>Ea</value>
                                <value>Pkt</value>
                                <value>Set</value>
                                <value>Tube</value>
                                <value>Pad</value>
                                <value>Ream</value>
                                <value>Tin</value>
                                <value>Bag</value>
                                <value>Ctn</value>
                                <value>Box</value>
                            </valueMap>
                        </field>
                        <field name="unitCost"    type="float"    title="Unit Cost"   required="true">
                            <validators>
                                <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/>
                                <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/>
                            </validators>
                        </field>
                        <field name="inStock"   type="boolean"  title="In Stock"/>
                        <field name="nextShipment"  type="date" title="Next Shipment"/>
                    </fields>
                </DataSource>
                What we've done here is added a new "required" type validator to the itemName field, and included a custom (localized) error message.
                Now modify the bootstrap file (BuiltInDS.html) to actually apply the french locale to the dataSource when loading it, changing this:
                Code:
                    <!--load the datasources-->
                    <script src="builtinds/sc/DataSourceLoader?dataSource=supplyItem,animals,employees"></script>
                to this
                Code:
                    <!--load the datasources-->
                    <script src="builtinds/sc/DataSourceLoader?dataSource=supplyItem,animals,employees&locale=fr"></script>
                Now load the app (note you may need to do a GWT compile to pick up the new resource bundle), and repeat the same steps - click "Office Supplies" from the list on the left, then hit the "New" button, then the "Save" button without populating any field.
                Now you'll see the modified, localized error message "Champs Requis Personnailise'

                Please let us know if this doesn't fully resolve this issue for you

                Thanks
                Isomorphic Software

                Comment

                Working...
                X