Wednesday, August 6, 2014

Re: How to let Hermes to switch to other properties file rather the default one?

found solution that is to use MyConstants

in client,

public interface MyConstants extends ConstantsWithLookup{      String id();  }  

MyConstants_de.properties

id=2121 


MyConstants.properties

id=4545

In server

MyConstants myConstants = Hermes.get(MyConstants.class, "");  myConstants.id(); //will print id=4545      MyConstants myConstants = Hermes.get(MyConstants.class, "de");  myConstants.id(); //will print id=2121  


On Wednesday, August 6, 2014 12:35:52 PM UTC+10, Tom wrote:

Ok, I am building GWT app and I am using Hermes to manage the constants at Server side.

Here is what I did:

I created MyConstantsWithLookup.properties (default English version) & MyConstantsWithLookup_de.properties (German version) & MyConstantsWithLookup.java in client package

-MyConstantsWithLookup.properties has

id=1245


-MyConstantsWithLookup_de.properties has

id=4556

-MyConstantsWithLookup.java

public interface MyConstantsWithLookup extends ConstantsWithLookup {     int id();  }  

There is Data.java in Server package. Data.java has

public static int id(){      try {          MyConstantsWithLookup myConstantsWithLookup = Hermes.get(MyConstantsWithLookup.class, "");          return myConstantsWithLookup.id();      } catch (IOException e) {          // TODO Auto-generated catch block          e.printStackTrace();      }      return "";  }  

Ok, it works fine if i open the page in English. Ex, myDomain.com it will show correctly the id=1245. However, if i open the page in German language myDomain.com?locale=de then it did not pick up the id=4556 but still use the old id.

Did i do anything wrong here?

How to fix it?

http://stackoverflow.com/questions/25151383/how-to-let-hermes-to-switch-to-other-properties-file-rather-the-default-one

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment