Am 27.06.2017 um 08:42 schrieb Lukasz Lenart:
> 2017-06-27 8:38 GMT+02:00 i...@flyingfischer.ch <i...@flyingfischer.ch>:
>> Thanks! This works fine. And you are perfectly right:
>>
>> StringEscapeUtils.unescapeHtml4(value.replaceAll("''", "'"));
>>
>> Is not needed anymore. It seemed, if I am not mistaken, to be necessary
>> with:
>>
>> LocalizedTextUtil.findDefaultText(key, getLocale());
>>
>> Single quotes in my properties files are escaped with two single quotes.
>>
>> Well it is and was kind of a hacky approach, to compensate for the lost
>> convenience method of getText(key) since 2.5.2. I do not like to do
>> things that way, and prefer to leave such details to the framework.
> Ah... I think it is the same problem as this issue [1], it will be
> resolved in 2.6 (or another 2.5.x) - which means your hack want be
> needed :) Sorry for that :(
>
> [1] https://issues.apache.org/jira/browse/WW-4742
>
>
> Regards
Thanks for the update.

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);

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

Markus



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

Reply via email to