简体   繁体   中英

GWT I18N - Display a String out of a list

I'm kinda new to GWT. I want to display a certain string in my browser. This string depends on what components are updating and the amount of updating components can vary. The components that are updating are saved in a List<String> .

This is my code i use at the moment

public interface ComplexMessages extends com.google.gwt.i18n.client.Messages {

        @DefaultMessage("Updating firmware on component(s): <br/> {0, list, text}")
        @Key("componentUpdateStatus")
        @AlternateMessage({
            "one", "Updating firmware on component(s): <br/> {0, list, text}"
        })
        String componentUpdateStatus(@PluralCount(DefaultRule_en.class) List<String> components);

When i trigger my components to update it displays the message:

"Updating firmware on components: 2".

Instead of

"Updating components: Component 1, Component 2.

(in this situation 2 components were updating).

I red something about using {0, list, text} to display the string of a list, but that doesn't seem to solve the issue.

Does anyone know if it is possible to display multiple and a variable amount strings in one GWT message by retrieving them out of a List<String> ?

Thanks in advance

It seems that the message format for lists doesn't like spaces in it.

Just remove spaces from the format: {0,list,text} and it will work. Tested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM