Wednesday, September 8, 2010

Re: Messages with plural text in a property file

Ok, I have fixed the issue like this:
I renamed my property file to PBVMessageConstants_en.properties
and in my module, I have added the following:
<extend-property name="locale" values="en"/>
<set-property-fallback name="locale" value="en"/>

I am not sure yet of what will happen with a french browser or
something else.

A good link to have more information:
http://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html

On Sep 1, 3:02 pm, Guillaume <guillaume.po...@gmail.com> wrote:
> Hi,
>
> I have written aGWTapplication which uses the Messages interface to
> render all the strings across the app. I would have liked to use thePluraltextfeature to render the string differently according to a
> "count" parameter. Unfortunately, I can't get this to work, I
> constantly get the default value
>
> This is how I have done this so far:
> In my interface extending Messages:
>
> public interface PBVMessageConstants extends Messages {
>         public static final PBVMessageConstants instance =GWT.create(PBVMessageConstants.class);
>
>     public String addOrderItemTooltip(@PluralCount @Optional int
> itemCount);
>
> // ... and many more methods
>
> }
>
> and in the PBVMessageConstants.propertiesfileI have:
>
> addOrderItemTooltip=Add these items to your selection
> addOrderItemTooltip[one]=Add this item to your selection
>
> I then invoke the interface like this:
> PBVMessageConstants.instance.addOrderItemTooltip(products.size())
> but even when the products List has only one item, I still have thepluralmessage
>
> Am I missing something obvious? Thanks in advance to anyone who can
> help me.

--
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.

No comments:

Post a Comment