Re: Strange issue displaying numbers when in Arabic locale

Zoran Avtarovski <[email protected]> Tue, 22 Apr 2025 12:34:51 +1000
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
Thanks Lukasz,

I'll submit a ticket and the fix we finally went with. We ended up going 
with interceptor params to implement. We made small changes to 3 files:

 1. LocaleProvider interface
 2. DefaultLocaleProvider
 3. I18nInterceptor

It's been working well in our prod environment.

Z.

On 17/4/2025 3:30 pm, Lukasz Lenart wrote:
> pon., 7 kwi 2025 o 01:47 Zoran Avtarovski<[email protected]> napisał(a):
>> Thanks Lukasz, Uti,
>>
>> The issue indeed was how Java treated numbers after Java 8.
>>
>> After a inordinate amount of searching on how to change the solution was
>> to set the locale extension on how to treat numbers.
>>
>> Instead of just creating a Locale using the language code I used a local
>> builder extension to set the number units (NU) as such:
>>
>> locale = new
>> Locale.Builder().setLanguage(localeStr).setExtension(Locale.UNICODE_LOCALE_EXTENSION,
>> "nu-latn").build();
>>
>> This keeps the locale as Arabic/Pashto/etc but forces display of numbers
>> in Latin form which is what we needed.
>>
>> Lukasz, I had a look at your fix and I think by applying the above code
>> in the I18N Interceptor in Struts 7 you can treat the issue at the
>> source and numbers are displayed correctly.
> Thanks for the hint, yet I'm not sure if this is expected behaviour.
> Maybe having this as a configuration option would make more sense,
> allowing users to decide when to use it. This change impacts
> formatting of all numbers so it can be devastating in some cases.
>
> Feel free to register a ticket in JIRA!
>
>
> Regards
> Łukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:[email protected]
> For additional commands, e-mail:[email protected]
>