Strange behavior of the Language Selector component

Hello everybody.

We are experiencing a strange behavior of the “Language Selector” component.

The following picure show our custom authentication dialog, where the customer could also change the language.


ONLY the first time that the client starts, the selector shows three options:

• English
• français
• français (France)

But we expect only the first two.
As soon you select one of them, “magically” the component arranges its items and it shows only two languages:


Why?
Does exists a workaround to fix this?

Thanks in advance.

It’s a byproduct of a workaround we had to do, and is on our list of annoyances to fix some day.

What happens is that we need to make sure the currently selected locale is in the drop down list so it can be the selected item (i.e. the item you see when you haven’t clicked on the drop down yet.) When you start the client, if you didn’t change the locale at the log in screen, the current locale is the locale reported by the JVM. Once you’ve made a change with the language selector (or via scripting), the current locale will be one from the locales you’ve defined in the translations. Since the list of locales retrieved by the language selector includes the current locale, nothing extra gets added.

Currently, your work around would be to set the locale with scripting when the client opens. The good news is that while I was typing this explanation, I figured out a fix for the problem and it should be able to get into 7.7.4.

Ohh yes, now it works.

Now, inside our client startup script, I have written:

system.util.setLocale([color=#FF0000]“fr”[/color])

instead of

system.util.setLocale([color=#FF0000]“fr_FR”[/color])

Now we see always only two entries.
Thank you.

Has this been fixed in 7.7.4 ?
I am making a project on a french computer. The project will have 2 languages English and slovak. I however still have a “français” option in my language selector. And it dissapears as well when I select a language.

I think so. From the 7.7 change log, I see “Language selector no longer adds variants that duplicate existing languages.” which looks like the fix.

Ah okay, it is not that exact bug then.
My problem is that it adds a language that is not contained in the Translation Manager.

The workaround used here works however.

The same issue still happens in igntion 8.1.33 on traditional Chinese language.
Initial start:
1

After selection:
2

I want my default laguage shows on language selector componet is English, and the actual locale is Taiwan. Any idea how to fix this issue?
Thanks!

You're wanting to change your default language from English to Taiwan? ...or you're wanting the locale to be Taiwan while English is selected?

Two purposes:

  1. To solve the bug above, I don't want “Language selector adds variants that duplicate existing languages.”
  2. Show the default language to Traditional Chinese in clients.

As the picture below, I have three languages.
3

I use the system.util.getLocale() to get the actual locale name when I change selection on language selector, the result are 'zh__#Hant' , 'en', 'ja'.
To avoid the component bug, I tried to use system.util.setLocale to set the locale to 'zh__#Hant' , 'en', 'ja' , that works perfectly on 'en', 'ja' and fixed the issue, but doesn't work on 'zh__#Hant', I got an error says it's an invalid format.
4

I believe I used a wrong locale number for Traditional Chinese, I tried'zh','zh-TW', the result are bad, anybody knows the correct locale corresponds to 'zh__#Hant'?

I'm a beginner of igntion and still not pretty sure what will happen after system.util.setLocale() execution, does this only work on language change? I am concerned about some potential changes, such as time zones, etc, that's not what I want.

Hmm... looks like we could have implemented getLocale() a bit better (having it return the language tag instead of the toString() of the Locale). I'll make a ticket to improve how we handle it when you try to use that result to set a Locale.

I'm afraid I don't know enough about the various forms of Chinese to give you a definitive answer, but the supported Locales and their language tags can be found here. It would seem that zh-TW should have worked, but since it didn't I'm not sure where to go from here.

1 Like