2017-06-27 8:59 GMT+02:00 i...@flyingfischer.ch <i...@flyingfischer.ch>:
> For the time being, it really can't be shorter than this?:
>
>         final LocaleProviderFactory factory =
> ActionContext.getContext().getInstance(LocaleProviderFactory.class);
>         final Locale locale = factory.createLocaleProvider().getLocale();
>         final ResourceBundle bundle =
> ResourceBundle.getBundle("global-messages", locale);
>         final LocalizedTextProvider provider =
> ActionContext.getContext().getInstance(LocalizedTextProvider.class);
>         final String value = provider.findText(bundle, key, locale);

Why do you need a bundle? If you defined the "global-messages" in the
"struts.custom.i18n.resources" you do need to refer to a bundle
anymore.

> provider.findText seems to need an additional argument. And does
> factory.createLocaleProvider().getLocale() by any chance return null?

It can but only when you call this code out of action flow - the same
as using ActionContext.getContext().getLocale()


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to