Wednesday, December 14, 2011

Formatting lists with GWT i18n API

Hi,

I'm trying to format a list of Strings using a Messages interface:

@DefaultLocale("pt_BR")
public interface AppMessages extends Messages {

@DefaultMessage("elementos: {0, list}")
@AlternateMessage({"one", "elemento: {0, list}"})
String formatElements(@PluralCount List<String> elements);

}

In my module.gwt.xml, I have:

<!-- languages supported -->
<extend-property name="locale" values="pt_BR" />
<set-property-fallback name="locale" value="pt_BR" />

But when I try to format a list, for example:

AppMessages appMessages = GWT.create(AppMessages.class);
appMessages.formatElements(Arrays.asList({"A"}));
appMessages.formatElements(Arrays.asList({"A","B","C"}));

I get:

"elemento: 1"
"elementos: 3"

Instead of:

"elemento: A"
"elementos: A, B e C"

I'm using pt_BR for default locale, since it is the only language my
app supports for now. Does it only work for en? I tryied to change the
default locale for en, but it didn't work either :(

So, what I'm doing wrong?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate