In dev mode perhaps work, but in production mode (when is translate to js) I
suppose don't work

2011/10/5 Thiago Coraini <[email protected]>

> Actually, neither Locale nor MessageFormat are on this list. But
> magically both appear to be working on the client.
>
> I'm almost sure I'm missing something here, but I just don't know
> what!
>
> On Oct 5, 3:59 pm, Juan Pablo Gardella <[email protected]>
> wrote:
> > Is the class and the method do you need are
> > here<
> http://code.google.com/intl/es/webtoolkit/doc/latest/RefJreEmulation....>,
> > yes.
> >
> > 2011/10/5 Thiago Coraini <[email protected]>
> >
> >
> >
> >
> >
> >
> >
> > > Hello all,
> >
> > > I'm relatively new to GWT. I'm actually developing a web application
> > > using SmartGWT, don't know if you've heard of it.
> >
> > > Anyway, I'm trying to format some internationalized messages. In the
> > > server, I'm using the Java built-in support, through
> > > java.text.MessageFormat class. But after doing some research, I
> > > understood that this would not work on the client side. But when I run
> > > the following code in a client-side class:
> >
> > > ---------
> > > String message = "Number: {0}";
> > > Log.debug( "[Is Client: " + GWT.isClient() + "] Before formatting: " +
> > > message );
> > > MessageFormat formatter = new MessageFormat( message );
> > > message = formatter.format( new Object[] { 2.5 } );
> > > Log.debug( "[Is Client: " + GWT.isClient() + "] After formatting: " +
> > > message );
> > > ---------
> >
> > > I get the following output:
> >
> > > ---------
> > > (WebApplicationContext.java:51) 2011-10-05 15:07:19,662 [DEBUG] [Is
> > > Client: true] Before formatting: Number: {0}
> > > (WebApplicationContext.java:56) 2011-10-05 15:07:19,690 [DEBUG] [Is
> > > Client: true] After formatting: Number: 2,5
> > > ---------
> >
> > > This is using my default locale, 'pt_BR'. But I can even change it
> > > with:
> >
> > > ---------
> > > Locale locale = new Locale( "en", "US" );
> > > formatter.setLocale( locale );
> > > ---------
> >
> > > and then I would get the output:
> >
> > > ---------
> > > (WebApplicationContext.java:52) 2011-10-05 15:12:08,592 [DEBUG] [Is
> > > Client: true] Before formatting: Number: {0}
> > > (WebApplicationContext.java:59) 2011-10-05 15:12:08,621 [DEBUG] [Is
> > > Client: true] After formatting: Number: 2.5
> > > ---------
> >
> > > When I load my application in the browser, GWT output complains that
> > > there is no source code available for both java.text.MessageFormat and
> > > java.util.Locale. But, even then, the locale-specific formatting
> > > appears to be working perfectly.
> >
> > > Does anyone understands what is happening?
> >
> > > Thank you very much!
> >
> > > Best regards,
> > > Thiago
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google Web Toolkit" 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-web-toolkit?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" 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-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to