Tiago,
All interfaces marked with @MessageBundle or @MessageLogger generate
concrete classes at compile-time. Getting a locale implementation of a
@MessageBundle by default uses the Locale.getDefault(). You can specify
a locale too when getting an implementation.
I would suggest creating static variables, generally placed on the
interface, for each locale if they're aren't too many. Something like:
@MessageBundle(projectCode = "example")
public interface MessageExample {
MessageExample MESSAGES = Messages.getMessage(MessageExample.class);
MessageExample MESSAGES_DE =
Messages.getMessage(MessageExample.class, Locale.GERMANY);
@Message("Example message 1")
String exampleMessage();
@Message("Example Error: %s")
IllegalStateException exampleExcetion(@Cause Throwable cause,
String errorMessage);
}
On 01/15/2013 06:23 AM, Pete Muir wrote:
Yes, we would recommend this approach.
James can comment on the Messages object.
On 14 Jan 2013, at 17:45, Tiago Ferreira wrote:
> Hello,
>
> i am trying to build a web app to support several users and languages. I
> took a look at the kitchensink-ear example and i have some questions.
>
> Is this the best way to i18n a web aplication?
> Does the Messages object need to be recreated each time a request is
> made from a different locale?
>
> thank you
> Tiago
> _______________________________________________
> jdf-dev mailing list
> jdf-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/jdf-dev
--
James R. Perkins
JBoss by Red Hat