You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2016/02/29 18:21:18 UTC

[jira] [Commented] (SLING-5137) Locale in Sightly I18N RuntimeExtension is not used correctly

    [ https://issues.apache.org/jira/browse/SLING-5137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15172179#comment-15172179 ] 

Konrad Windszus commented on SLING-5137:
----------------------------------------

I just had a look at the fix and to me it would be better to explicitly throw an exception in case of invalid locales, instead of just logging the issue and silently return the untranslated key. This is related to SLING-4442.

> Locale in Sightly I18N RuntimeExtension is not used correctly
> -------------------------------------------------------------
>
>                 Key: SLING-5137
>                 URL: https://issues.apache.org/jira/browse/SLING-5137
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting Sightly Engine 1.0.0
>            Reporter: Michael Kreis
>            Assignee: Radu Cotescu
>             Fix For: Scripting Sightly Engine 1.0.16
>
>
> When using a locale option with country in an i18n sightly expression (e.g. ${'label.key' @ i18n, locale='de_CH'}) the locale is not created correctly. 
> See following line:
> https://github.com/apache/sling/blob/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/I18nRuntimeExtension.java#L84
> new Locale(locale) only sets the language but never a country.
> Should use something like Apache Commons LocaleUtils.toLocale() (https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/LocaleUtils.html#toLocale(java.lang.String))



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)