You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "info@flyingfischer.ch" <in...@flyingfischer.ch> on 2017/06/25 14:14:32 UTC

Struts 2.5.11: js based messages not showing up, when chanching default locale

Another issue, since 2.5.11:

Javascript boxed messages display, if the language is the default
language (en). As soon as switching the application to another locale
(e.g. de), js-box messages do not display anymore...

...this IS NOT related to retrieving the values from the corresponding
language-properties files: in debug mode I can see, the correct values
being retrieved.

Even with hardcoded, simple values without i18n: messages will not be
displayed, if the application is not running on the default locale.


<script type="text/javascript">
		notif({
	           msg: "<s:property value="jsmsg.msg" escapeHtml="false" />",
	           type: "<s:property value="jsmsg.type" />",
	           position: "<s:property value="jsmsg.position" />",
	           opacity: <s:property value="jsmsg.opacity" />,
	           timeout: <s:property value="jsmsg.timeout" />,
	           multiline: <s:property value="jsmsg.multiline" />,
	           autohide: <s:property value="jsmsg.autohide" />,
	           clickable: <s:property value="jsmsg.clickable" />
});
</script>

I am puzzled, because again: it is hard to imagine, this to be struts
related. But there is no such issue in 2.5.10.1.

Markus

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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale [resolved]

Posted by Lukasz Lenart <lu...@apache.org>.
2017-06-27 8:16 GMT+02:00 info@flyingfischer.ch <in...@flyingfischer.ch>:
> private String opacity = "0.9";
>
> This works with <s:property/>

Right, this does not depend on Number Conversion :)


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

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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale [resolved]

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
Am 27.06.2017 um 08:12 schrieb Lukasz Lenart:
> 2017-06-26 21:27 GMT+02:00 info@flyingfischer.ch <in...@flyingfischer.ch>:
>> Now EL brings replaces
>>
>> <s:property value="jsmsg.opacity" />
>>
>> in locale en with 0.9 and in all other locales with 0,9 (note the COMMA).
> Oh... thanks a lot for diggin this, can you use <s:number/> instead of
> <s:property/>?
>
>
> Regards
I did switch to in JSMessage object to

private String opacity = "0.9";

This works with <s:property/>

Markus

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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale [resolved]

Posted by Lukasz Lenart <lu...@apache.org>.
2017-06-26 21:27 GMT+02:00 info@flyingfischer.ch <in...@flyingfischer.ch>:
> Now EL brings replaces
>
> <s:property value="jsmsg.opacity" />
>
> in locale en with 0.9 and in all other locales with 0,9 (note the COMMA).

Oh... thanks a lot for diggin this, can you use <s:number/> instead of
<s:property/>?


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

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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale [resolved]

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
> Very strange: values do get replaced:
>
> <script type="text/javascript">
> notif({
> msg: "Ungültige Angaben!",
> type: "info",
> position: "center",
> opacity: 0,9,
> timeout: 5000,
> multiline: true,
> autohide: true,
> clickable: false
> });
> </script>
>
> But JS box will still not show up, when not on default locale...
>
> ...any other ideas, what could trigger this difference between 2.5.10.1
> and 2.5.11?
>
> Thanks!
>
> Markus
>
Found the root cause:

The property opacity expects a value between 0 and 1, separated by DOT.

The object JSMessage uses

private BigDecimal opacity = new BigDecimal("0.9");

Now EL brings replaces

<s:property value="jsmsg.opacity" />

in locale en with 0.9 and in all other locales with 0,9 (note the COMMA).

This is related to

https://issues.apache.org/jira/browse/WW-3650

Markus


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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
> I did some more tests:
>
> Test 1: in action hardcoded messages:
>
> jsmsg = new JSMessage("Show up!");
>
> On default locale: message shows up.
> Any other locale: No show up
>
> => Problem persists
>
> Test 2: in JSP hardcoded message
>
> <script type="text/javascript">
>         notif({
>                msg: "Show up!",
>                type: "info",
>                position: "center",
>                opacity: 0.9,
>                timeout: 5000,
>                multiline: true,
>                autohide: true,
>                clickable: false
> });
> </script>
>
> The show up works on all locales. => definitively not a JS issue.
>
> Conclusion
> There seems to be an EL problem while not on default locale? I suspect
> the properties not to be replaced by the corresponding values.
>
> <script type="text/javascript">
>         notif({
>                msg: "<s:property value="jsmsg.msg" escapeHtml="false" />",
>                type: "<s:property value="jsmsg.type" />",
>                position: "<s:property value="jsmsg.position" />",
>                opacity: <s:property value="jsmsg.opacity" />,
>                timeout: <s:property value="jsmsg.timeout" />,
>                multiline: <s:property value="jsmsg.multiline" />,
>                autohide: <s:property value="jsmsg.autohide" />,
>                clickable: <s:property value="jsmsg.clickable" />
> });
> </script>
>
> Could this be an approach to further debug the issue in 2.5.11?
>
> Thanks!
> Markus
>

Very strange: values do get replaced:

<script type="text/javascript">
notif({
msg: "Ungültige Angaben!",
type: "info",
position: "center",
opacity: 0,9,
timeout: 5000,
multiline: true,
autohide: true,
clickable: false
});
</script>

But JS box will still not show up, when not on default locale...

...any other ideas, what could trigger this difference between 2.5.10.1
and 2.5.11?

Thanks!

Markus

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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
> At the moment testing locally and not online:
>
> Browser send en-US,en;q=0.5 on default
> OS linux on german locale
> changing locale in application by ?request_locale=it
> in struts.properties: struts.custom.i18n.resources=global-messages
>
> properties files:
>
> global-messages_de.properties
> global-messages_en.properties
> global-messages_fr.properties
> global-messages_it.properties
> global-messages.properties
>
> The later being a duplicate of global-messages_en.properties, since the
> fallback to en for other languages never worked without it.
>
> Thanks for your feedback.
>
> Markus

I did some more tests:

Test 1: in action hardcoded messages:

jsmsg = new JSMessage("Show up!");

On default locale: message shows up.
Any other locale: No show up

=> Problem persists

Test 2: in JSP hardcoded message

<script type="text/javascript">
        notif({
               msg: "Show up!",
               type: "info",
               position: "center",
               opacity: 0.9,
               timeout: 5000,
               multiline: true,
               autohide: true,
               clickable: false
});
</script>

The show up works on all locales. => definitively not a JS issue.

Conclusion
There seems to be an EL problem while not on default locale? I suspect
the properties not to be replaced by the corresponding values.

<script type="text/javascript">
        notif({
               msg: "<s:property value="jsmsg.msg" escapeHtml="false" />",
               type: "<s:property value="jsmsg.type" />",
               position: "<s:property value="jsmsg.position" />",
               opacity: <s:property value="jsmsg.opacity" />,
               timeout: <s:property value="jsmsg.timeout" />,
               multiline: <s:property value="jsmsg.multiline" />,
               autohide: <s:property value="jsmsg.autohide" />,
               clickable: <s:property value="jsmsg.clickable" />
});
</script>

Could this be an approach to further debug the issue in 2.5.11?

Thanks!
Markus


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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
> 2017-06-25 16:14 GMT+02:00 info@flyingfischer.ch <in...@flyingfischer.ch>:
>> Another issue, since 2.5.11:
>>
>> Javascript boxed messages display, if the language is the default
>> language (en). As soon as switching the application to another locale
>> (e.g. de), js-box messages do not display anymore...
>>
>> ...this IS NOT related to retrieving the values from the corresponding
>> language-properties files: in debug mode I can see, the correct values
>> being retrieved.
>>
>> Even with hardcoded, simple values without i18n: messages will not be
>> displayed, if the application is not running on the default locale.
>>
>>
>> <script type="text/javascript">
>>                 notif({
>>                    msg: "<s:property value="jsmsg.msg" escapeHtml="false" />",
>>                    type: "<s:property value="jsmsg.type" />",
>>                    position: "<s:property value="jsmsg.position" />",
>>                    opacity: <s:property value="jsmsg.opacity" />,
>>                    timeout: <s:property value="jsmsg.timeout" />,
>>                    multiline: <s:property value="jsmsg.multiline" />,
>>                    autohide: <s:property value="jsmsg.autohide" />,
>>                    clickable: <s:property value="jsmsg.clickable" />
>> });
>> </script>
>>
>> I am puzzled, because again: it is hard to imagine, this to be struts
>> related. But there is no such issue in 2.5.10.1.
> How do you switch the locale? What default locale you are running on?
> How did you name your properties files?
>
>
> Regards

At the moment testing locally and not online:

Browser send en-US,en;q=0.5 on default
OS linux on german locale
changing locale in application by ?request_locale=it
in struts.properties: struts.custom.i18n.resources=global-messages

properties files:

global-messages_de.properties
global-messages_en.properties
global-messages_fr.properties
global-messages_it.properties
global-messages.properties

The later being a duplicate of global-messages_en.properties, since the
fallback to en for other languages never worked without it.

Thanks for your feedback.

Markus


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


Re: Struts 2.5.11: js based messages not showing up, when chanching default locale

Posted by Lukasz Lenart <lu...@apache.org>.
2017-06-25 16:14 GMT+02:00 info@flyingfischer.ch <in...@flyingfischer.ch>:
> Another issue, since 2.5.11:
>
> Javascript boxed messages display, if the language is the default
> language (en). As soon as switching the application to another locale
> (e.g. de), js-box messages do not display anymore...
>
> ...this IS NOT related to retrieving the values from the corresponding
> language-properties files: in debug mode I can see, the correct values
> being retrieved.
>
> Even with hardcoded, simple values without i18n: messages will not be
> displayed, if the application is not running on the default locale.
>
>
> <script type="text/javascript">
>                 notif({
>                    msg: "<s:property value="jsmsg.msg" escapeHtml="false" />",
>                    type: "<s:property value="jsmsg.type" />",
>                    position: "<s:property value="jsmsg.position" />",
>                    opacity: <s:property value="jsmsg.opacity" />,
>                    timeout: <s:property value="jsmsg.timeout" />,
>                    multiline: <s:property value="jsmsg.multiline" />,
>                    autohide: <s:property value="jsmsg.autohide" />,
>                    clickable: <s:property value="jsmsg.clickable" />
> });
> </script>
>
> I am puzzled, because again: it is hard to imagine, this to be struts
> related. But there is no such issue in 2.5.10.1.

How do you switch the locale? What default locale you are running on?
How did you name your properties files?


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

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