Announcement

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

    RPCManager.loadScreen internalization

    Hi,

    im trying to see localized titles as mentioned at documentation. But i couldnt find any way to implement that.

    Is there any working code or any explanation?

    below link is not enough for newbies!

    <http://www.smartclient.com/smartgwtee-latest/javadoc/com/smartgwt/client/docs/DataSourceLocalization.html>

    thanks..

    1. smartclient 8.3
    2. RPCRequest props = new RPCRequest();
    Map<String, String> params = new HashMap<String, String>();
    String mylocale = com.google.gwt.user.client.Window.Location.getParameter("locale"); // tr
    params.put("locale", mylocale);
    props.setParams(params);

    RPCManager.loadScreen(node.getScreenName(), new LoadScreenCallback() {

    @Override
    public void execute() {
    createTab(node);
    }
    }, node.getGlobals(), props);

    #2
    Most likely you are having issues because you've never used JSTL to do i18n before. Note the links to general reference on JSTL i18n - follow those for more background information and samples.

    Comment


      #3
      im not using jsp and i dont think my problem is about tags!

      Is there any way to use internalization only java code not with jsp..

      Comment


        #4
        Hmm, seems like you need a re-read of the docs you referenced. It does not use JSP. It uses JSTL tags in the same way that JSP uses it.

        Comment


          #5
          a part from my ds file
          <DataSource
          xlmns:fmt="WEB-INF/"..

          <fmt:bundle basename="my.package.Constants" />
          <fields>
          <field primaryKey="true" name="id" type="sequence"></field>
          <field name="name" length="255" type="text">
          <title><fmt:message key='mykey' /></title>
          </field>


          part from code

          RPCRequest props = new RPCRequest();
          Map<String, String> params = new HashMap<String, String>();
          String mylocale = com.google.gwt.user.client.Window.Location.getPara meter("locale"); // tr
          params.put("locale", mylocale);
          props.setParams(params);

          RPCManager.loadScreen(node.getScreenName(), new LoadScreenCallback() {

          @Override
          public void execute() {
          createTab(node);
          }
          }, node.getGlobals(), props);

          two property file names and keys

          Constants (default locale - accordinbg to gwt docs it must not has _tr suffix)
          mykey = deneme

          Constants_tr (dublicated. maybe smart ds needs suffixed file name!)
          mykey = deneme

          Constants_en
          mykey = test

          when i run the code it always returns "test" as key result! (it should be "deneme" since i pass tr parameter)

          i read and read documents and searched internet for this issue. Please explain whats wrong with my code..
          Last edited by cengaver; 17 Jan 2013, 00:38.

          Comment


            #6
            "tr" does not appear to be a valid Java locale code. Should be tr_TR. See core Java documentation.

            Comment


              #7
              thanks for reply, i have changed as "tr_TR" but still no luck!

              my rpcrequest comes like ;
              {
              "actionURL":"http://localhost:8080/myproject/myproject/sc/screenLoader",
              "showPrompt":false,
              "transport":"xmlHttpRequest",
              "useSimpleHttp":true,
              "promptStyle":"cursor",
              "params":{
              "screenName":"myscreen",
              >>> "locale":{
              "locale":"tr_TR"
              }
              }
              }

              screenName=myscreen&locale=%7B%22locale%22%3A%22tr_TR%22%7D

              since they should be;

              "actionURL":"http://localhost:8080/myproject/myproject/sc/screenLoader",
              "showPrompt":false,
              "transport":"xmlHttpRequest",
              "useSimpleHttp":true,
              "promptStyle":"cursor",
              "params":{
              "screenName":"myscreen",
              >>> "locale":"tr_TR"
              }
              }

              screenName=myscreen&locale=tr_TR

              the locale part of params is different. Could you please help me to send params like second one..

              RPCRequest props = new RPCRequest();
              what should i pass to props to get that result?

              Comment


                #8
                We're not seeing this effect. You've never posted your *exact* SGWT version, the browser you're testing with, or other details that are always required when posting questions.

                Please try the latest patched version from smartclient.com/builds, and if the issue is reproducible for you there, please post all the required details and we can take a look.

                Comment


                  #9
                  1. smartclient_v83p_2012-12-19_Enterprise and smartgwtee-3.1p (17.01.2013 build)

                  2. tested with two browsers compiled and hosted mode. chrome 24, ie 9

                  simply i have ds, ui, constants and java code files. (sorry i couldnt prepare small test case)

                  ds file;
                  <DataSource
                  xlmns:fmt="WEB-INF/"..

                  <fmt:bundle basename="my.package.Constants" />
                  <fields>
                  <field primaryKey="true" name="id" type="sequence"></field>
                  <field name="name" length="255" type="text">
                  <title><fmt:message key='mykey' /></title>
                  </field>..

                  constants;
                  Constants_tr_TR
                  mykey = deneme

                  Constants_en_US
                  mykey = test

                  java code;
                  RPCRequest props = new RPCRequest();
                  props.setAttribute("locale", "tr_TR");
                  RPCManager.loadScreen("uifile", new LoadScreenCallBack(){
                  @Override
                  public void execute(){
                  //do smt usefull..
                  }
                  }, new String[]{"canvasname"}, props);


                  when run like above it generates below result;

                  my rpcrequest comes like ;
                  {
                  "actionURL":"http://localhost:8080/myproject/myproject/sc/screenLoader",
                  "showPrompt":false,
                  "transport":"xmlHttpRequest",
                  "useSimpleHttp":true,
                  "promptStyle":"cursor",
                  "params":{
                  "screenName":"myscreen",
                  >>> "locale":{
                  "locale":"tr_TR"
                  }
                  }
                  }

                  screenName=myscreen&locale=%7B%22locale%22%3A%22tr _TR%22%7D

                  if i change generated link like;
                  screenName=myscreen&locale=tr_TR

                  everything works fine. but i cannot send props for create a link like that.

                  thanks..
                  Last edited by cengaver; 23 Jan 2013, 05:55.

                  Comment


                    #10
                    We have recently made some changes in this area which should address this issue. Please try the next nightly build on the 3.1p or 4.0d branch, dated May 15 or above and let us know if the problem persists for you

                    Thanks
                    Isomorphic Software

                    Comment

                    Working...
                    X