sorry the patch wasn't complete.
I posted the complete classes on my page:
http://www.jjoe64.com/java-coding/gwt-i18n-server-side

On 10 Dez., 08:13, Jonas Gehring <[email protected]> wrote:
> hi.
> there is a way to use the gwt constants/messages on the server side. I
> use it so:
>
> Checkouthttp://code.google.com/p/gwt-i18n-server/from SVN.
>
> Then you have to patch it for the GAE like I did it (see down).
>
> You have to copy your CONSTANTS.properties + MESSAGES to the folder
> war/nls_server.
>
> ---------------------- PATCH ----------------------
> Index: GenericX.java
> ===================================================================
> --- GenericX.java       (revision 1317)
> +++ GenericX.java       (revision 1676)
> @@ -21,9 +21,9 @@
>  import java.io.FileNotFoundException;
>  import java.io.IOException;
>  import java.io.InputStream;
> +import java.io.InputStreamReader;
>  import java.lang.reflect.InvocationHandler;
>  import java.lang.reflect.Method;
> -import java.security.AccessControlException;
>  import java.security.InvalidParameterException;
>  import java.util.Properties;
>
> @@ -31,11 +31,17 @@
>   *
>   */
>  public abstract class GenericX implements InvocationHandler {
> +       /**
> +        * @param c1 c
> +        * @param c2 c
> +        * @return r
> +        */
> +       public static boolean isA(Class<?> c1, Class<?> c2) {
> +               return c2.isAssignableFrom(c1);
> +       }
>         protected final Properties properties = new Properties();
> -       protected final Class<?> itf;
>
> -       @Override
> -       public abstract Object invoke(Object proxy, Method method, Object[]
> args) throws Throwable;
> +       protected final Class<?> itf;
>
>         /**
>          * @param _itf _itf
> @@ -48,6 +54,11 @@
>                 fillProperties(itf, lang);
>         }
>
> +       @Override
> +       public boolean equals(Object obj) {
> +               return obj == this;
> +       }
> +
>         protected void fillProperties(Class<?> itf, String lang) throws
> IOException {
>                 for (Class<?> superItf : itf.getInterfaces()) {
>                         fillProperties(superItf, lang);
> @@ -59,35 +70,22 @@
>                         in = load(baseName + ".properties");
>                 }
>                 if (in != null) {
> -                       properties.load(in);
> +                       properties.load(new InputStreamReader(in, "UTF-8"));
>                 }
>         }
> +
> +       @Override
> +       public int hashCode() {
> +               return properties.size();
> +       }
> +
> +       @Override
> +       public abstract Object invoke(Object proxy, Method method, Object[]
> args) throws Throwable;
> +
>         protected InputStream load(String s) throws FileNotFoundException {
>                 InputStream in = null;
>                 in = loadPropertiesGAE(s);
>
> -               ClassLoader cl;
> -               cl = Thread.currentThread().getContextClassLoader();
> -               if (cl != null) {
> -                       in = cl.getResourceAsStream(s);
> -               }
> -               if (in == null) {
> -                       cl = getClass().getClassLoader();
> -                       if (cl != null) {
> -                               in = 
> getClass().getClassLoader().getResourceAsStream(s);
> -                       }
> -                       if (in == null) {
> -                               try {
> -                                       cl = 
> ClassLoader.getSystemClassLoader();
> -                               } catch (AccessControlException e) {
> -                                       /* GAE compatibility */
> -                                       in = loadPropertiesGAE(s);
> -                               }
> -                               if (cl != null) {
> -                                       in = cl.getResourceAsStream(s);
> -                               }
> -                       }
> -               }
>
>                 return in;
>         }
> @@ -99,23 +97,4 @@
>                         return null;
>                 }
>         }
> -
> -       @Override
> -       public boolean equals(Object obj) {
> -               return obj == this;
> -       }
> -
> -       @Override
> -       public int hashCode() {
> -               return properties.size();
> -       }
> -
> -       /**
> -        * @param c1 c
> -        * @param c2 c
> -        * @return r
> -        */
> -       public static boolean isA(Class<?> c1, Class<?> c2) {
> -               return c2.isAssignableFrom(c1);
> -       }
>  }
>
> On 9 Dez., 20:30, Erick Fleming <[email protected]> wrote:
>
>
>
>
>
>
>
> > Java has a fair amount of i18n built-in [1], are you using JSPs or
> > some other template engine?
>
> > [1]http://java.sun.com/javase/technologies/core/basic/intl/
>
> > On Thu, Dec 9, 2010 at 12:48 PM, nacho <[email protected]> wrote:
> > > How can i use internationalization over appengine (java) on the server
> > > side?
>
> > > Does any one have any idea?
>
> > > I've been googling but all the posts that i find are for python
> > > appengine.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Google App Engine" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to 
> > > [email protected].
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > Erick Fleming

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to