Announcement

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

    DataSource Localization

    I'm trying to set up data source localization and I'm not able to get it working.

    I'm using version: Isomorphic SmartClient/SmartGWT Framework (v12.1p_2020-06-04/Enterprise Deployment 2020-06-04)

    Here's my ds.xml:
    Code:
    <DataSource ID="CodeTypeSQL"
                serverType="sql"
                tableName="code_type"
                xmlns:fmt="WEB-INF/">
        <fmt:bundle bundle="com.assaabloy.protech.client.DSMessages"/>
        <fields>
            <field name="code_type_id" type="integer" primaryKey="true" hidden="true"/>
            <field name="description" type="text" length="100">
                <title>
                    <fmt:message key="description"/>
                </title>
            </field>
            <field name="allow_edits" type="boolean" sqlStorageStrategy="integer" required="true"/>
            <field name="parent_code_type_id" type="integer" foreignKey="CodeTypeSQL.code_type_id" joinType="outer" displayField="parentCodeType"/>
            <field name="parentCodeType" type="text" length="100" includeFrom="CodeTypeSQL.description" hidden="true"/>
        </fields>
    </DataSource>
    I have my properties file being deployed to WEB-INF/classes/com/assaabloy/protech/client/DSMessages.properties:
    Code:
    description=Description
    I added an "en_US" version as well just to check: DSMessages_en_US.properties.

    I verified that the servlet request is able to get the locale from the data source loader by doing the suggestion from here: https://forums.smartclient.com/forum...roperties-file. It's returning "en_US".

    Is there something incorrect about this setup? I get a blank column header when this data source is bound to a listgrid.

    #2
    Hi aderosso,

    first check is to look at the result of your DataSourceLoader call in a new browser tab and search for title there. What do you see?

    Best regards
    Blama

    Comment


      #3
      Get rid of the whitespace around your <fmt> tag. There is a warning about this in the DataSource Localization docs - what's likely happening is that the title is working but it's not appearing because of a linefeed.

      Note that you can check whether the <fmt> tag is working at all by just looking at the DataSourceLoader output, which is easy enough to read (it's just JSON), or by calling DataSource.getField().getTitle().

      Comment


        #4
        Thanks for the quick responses. I removed the white space, no change. Here's the output from the DataSourceLoader:

        Code:
        if (window.isc == undefined || window.isc.DataSource == undefined) {
            alert("Can't load DataSources - SmartClient runtime not loaded");
        }
        isc.DataSource.create({
            allowAdvancedCriteria: true,
            tableCode: "230880f3106c258c7c6167e4917484a0",
            serverType: "sql",
            isServerDS: true,
            ID: "CodeTypeSQL",
            fields: [{
                name: "code_type_id",
                columnCode: "bdb143d3b1e1c5e48e8cca75f2b551a8",
                hidden: true,
                type: "integer",
                validators: [],
                primaryKey: true
            }, {
                length: 100,
                name: "description",
                columnCode: "67daf92c833c41c95db874e18fcb2786",
                type: "text",
                title: "<fmt:message key=\"description\">",
                validators: []
            }, {
                name: "allow_edits",
                columnCode: "9c09629b545f7294aa5d4960eecb3ef4",
                type: "boolean",
                required: true,
                validators: []
            }, {
                useLocalDisplayFieldValue: true,
                validators: [],
                joinType: "outer",
                name: "parent_code_type_id",
                displayField: "parentCodeType",
                columnCode: "40ff567e1b8353c9c17cb6f4615bc0ad",
                type: "integer",
                foreignKey: "CodeTypeSQL.code_type_id"
            }, {
                hidden: true,
                validators: [],
                canEdit: false,
                length: 100,
                name: "parentCodeType",
                columnCode: "7fb53aa1892596f56b919de70711722e",
                type: "text",
                title: "<fmt:message key=\"description\">"
            }]
        })

        Comment


          #5
          OK, the <fmt> tag is not being interpreted at all. One explanation for this would be if you removed files from the normal deployment, for instance, do you see DataSource.ds.xml and DataSourceField.ds.xml in your "war/" area (typically in the sc/schema folder)? These files are normally copied during the GWT compile.

          If you either hand-deleted them, or did something like use the LGPL modules while adding our .jars to your server, you could produce this problem.

          You should also check your server logs for any warnings that occur when the DataSourceLoader servlet is invoked.

          Comment


            #6
            I double checked, no error messages in the logs. I do see DataSource.ds.xml and DataSourceField.ds.xml in the running war folder. The jars on the server should be accurate, they all come from the maven dependency.

            Is there anything else I can do to debug this?

            Comment


              #7
              We did not notice earlier that your declaration of fmt:bundle element is not accurate. Like it is described in DataSource and Component XML Localization docs, it should have basename attribute defining bundle name instead of bundle. So, it turns out that your bundle just could not picked up due to incorrect declaration.

              To make it clear in the future we've added a warning to server logs reporting what exactly went wrong.

              Comment


                #8
                Thank you! That fixed the issue.

                Comment

                Working...
                X