Directory

← Back

icu4j-spring-vaadin

Vaadin Add-on that gives you easy integration of ICU4J into the Spring/Vaadin environment

Author

Rating

Popularity

<100

Do you like ICU4J, Vaadin and Spring?

Here comes the Add-on that will allow you to connect all three elements right together!

This Add-on provides you with Spring MessageSource compatible wrapper of ICU4J MessageFormat that uses VaadinSession to obtain the Locale from current session.

Use ICU4J to boost the UX by speaking to the user more humanly

// smart plural plural={0} {0, plural, one{car}other{cars}}

// really smart plural plural={0} {0, plural, one{auto}few{auta} many{aut}other{aut}}

// named parameters names={username}, you have {unread} unread messages of {total}

// spell out numbers spellout={0, spellout} dollars

And much more... See the ICU4J syntax options link.

Sample code

 @Bean(name = "uiMessages")
    public VaadinICUMessageSource getUIMessages() {
        VaadinICUMessageSource uiMessages = new VaadinICUMessageSource();
        uiMessages.setBasename("classpath:uiMessages");
        uiMessages.setCacheSeconds(3600);
        uiMessages.setFallbackToSystemLocale(false);
        return uiMessages;
    }

 @SpringUI
    public class MainUI extends UI {

        @Autowired
        private VaadinICUMessageSource uiMessages;

        private int counter = 0;

        @Override
        protected void init(VaadinRequest request) {
            setContent(new Button(uiMessages.get("label"), e -> {
                Notification.show(uiMessages.get("notification", counter));
                counter++;
            }));
        }

    }

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

First version of the Add-on

Released
2017-02-17
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.7+
Browser
Browser Independent

icu4j-spring-vaadin - Vaadin Add-on Directory

Vaadin Add-on that gives you easy integration of ICU4J into the Spring/Vaadin environment icu4j-spring-vaadin - Vaadin Add-on Directory
Do you like ICU4J, Vaadin and Spring? Here comes the Add-on that will allow you to connect all three elements right together! This Add-on provides you with Spring MessageSource compatible wrapper of ICU4J MessageFormat that uses VaadinSession to obtain the Locale from current session. # Use ICU4J to boost the UX by speaking to the user more humanly // smart plural plural={0} {0, plural, one{car}other{cars}} // really smart plural plural={0} {0, plural, one{auto}few{auta} many{aut}other{aut}} // named parameters names={username}, you have {unread} unread messages of {total} // spell out numbers spellout={0, spellout} dollars And much more... See the ICU4J syntax options link.
Issue Tracker
Source Code
ICU4J syntax options

icu4j-spring-vaadin version 1.0
First version of the Add-on

Online