Spring Roo
  1. Spring Roo
  2. ROO-893

Add i18n support to the generated GWT scaffold app

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Deferred
    • Affects Version/s: 1.1.0.M1
    • Fix Version/s: 1.1.0.RC1
    • Component/s: GWT
    • Labels:
      None

      Description

        Activity

        Hide
        Rogelio Flores added a comment -

        Please add this feature!!!

        It should be very easy with the approach I outline below (done for my Roo/GWT app which supports UiBinder and Java files, but I haven't added support for all my ui.xml files for all my entities since each entity has a set of these files:

        EntityDetailsView.ui.xml
        EntityEditView.ui.xml
        EntityListEditor.ui.xml
        EntityListView.ui.xml
        EntityMobileDetailsView.ui.xml
        EntityMobileEditView.ui.xml

        and this is tedious/boiler-plate code that Roo should be able to handle at the time these files are created).

        Following the methodology below, GWT "issue" 4355 is a non-issue with two simple steps:

        1. Create GWT Messages/Constants java interface and their corresponding properties files in some package like: topLevelPackage.client.i18n
        2. Add i18n strings to views/widgets:
        2a. to Uibinder files, add:
        <ui:with field="i18n" type="topLevelPackage.client.i18n.AppConstants" />
        to the top of the page after the xmlns declarations.
        To use strings in html (like in an HTMLPanel):
        <ui:text from="

        {i18n.myString}" />
        To use strings in widget declarations (e.g., a Button):
        <g:Button ui:field='editButton' text="{i18n.myString}

        ">
        2b. to Java files, use the usual way in GWT:
        AppConstants i18n = GWT.create(AppConstrants.class);
        i18n.myString(); // usage

        Of course, this assumes the languages are specified in the module.gwt.xml.

        Show
        Rogelio Flores added a comment - Please add this feature!!! It should be very easy with the approach I outline below (done for my Roo/GWT app which supports UiBinder and Java files, but I haven't added support for all my ui.xml files for all my entities since each entity has a set of these files: EntityDetailsView.ui.xml EntityEditView.ui.xml EntityListEditor.ui.xml EntityListView.ui.xml EntityMobileDetailsView.ui.xml EntityMobileEditView.ui.xml and this is tedious/boiler-plate code that Roo should be able to handle at the time these files are created). Following the methodology below, GWT "issue" 4355 is a non-issue with two simple steps: 1. Create GWT Messages/Constants java interface and their corresponding properties files in some package like: topLevelPackage.client.i18n 2. Add i18n strings to views/widgets: 2a. to Uibinder files, add: <ui:with field="i18n" type="topLevelPackage.client.i18n.AppConstants" /> to the top of the page after the xmlns declarations. To use strings in html (like in an HTMLPanel): <ui:text from=" {i18n.myString}" /> To use strings in widget declarations (e.g., a Button): <g:Button ui:field='editButton' text="{i18n.myString} "> 2b. to Java files, use the usual way in GWT: AppConstants i18n = GWT.create(AppConstrants.class); i18n.myString(); // usage Of course, this assumes the languages are specified in the module.gwt.xml.
        Hide
        Alan Stewart added a comment -

        You can provide a patch if you like.

        Show
        Alan Stewart added a comment - You can provide a patch if you like.

          People

          • Assignee:
            Chris Ramsdale
            Reporter:
            Chris Ramsdale
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: