Enterprise: Timepicker/popover: Language is reset to value of Locale

Created on 15 Oct 2019  路  11Comments  路  Source: infor-design/enterprise

Describe the bug
We are setting language and locale separately, as described here:
https://design.infor.com/code/ids-enterprise/latest/locale#code-example---using-a-different-language-and-locale

When opening a popover / timepicker, the language is changed to the value of locale (possibly due to initialize() being called for sub-content).

Pseudo Example:
Locale.set("fi-FI"); // Finnish
Locale.setLanguage("sv"); // Swedish

In attached GIF below, it's seen that

  1. Initially, language is Swedish in the components (in the GIF, "Obligatoriskt" is shown for the required input field)
  2. Open timepicker. "Aseta aika" is the button text, which is Finnish
  3. After this, all soho controls use Finnish translations instead of Swedish
    lang-issue

We also noticed that some texts are always translated based on Locale, and not Language, in some components. Example below is the datepicker (the issue is not due to popover/timepicker being opened, it's like this from the start)
image

Expected behavior
If using Locale.setLanguage(), that language should be used for translations in all IDS components, and not be changed as a result of automatic plugin initializations.

Version

  • ids-enterprise: 4.21.2
[2] high homepages type

All 11 comments

Adding to 4.22 final and as a possible patch 4.21.3 on request from the home page team.

Steps to reproduce

  • go to http://localhost:4000/components/timepicker/example-index.html?locale=fi-FI
  • in the console type Locale.currentLanguage confirm it is finish
  • type Locale.setLanguage("sv");
  • type Locale.currentLanguage -> confirm its swedish
  • open the popup -> notice its in finish and not swedish as expected
  • type Locale.currentLanguage -> confirm its swedish

Ok nevermind but noting one thing...you should do

 Locale.setLanguage("sv"); // Swedish
// Not Locale.setLanguage("sv-SE"); // Swedish

Oh, right. We're doing that, I'll correct it in description!

@volante007 can you test this fix. I pushed it to test in the 4.22 final. But it's a bit more involved that i would like for a 4.21.x patch. I think it should be ok. But adds tiny a bit of risk.

Will patch if still desired when tested and merged by everyone.

Hi, I checked out branch 2982-lang-resets and built the minified bundle. Works OK!

Though it seems like the translations in datepicker are a mix of locale/language still, but perhaps that's a separate issue?

I guess so. It depends whats required for example if you go to:
1) http://localhost:4000/components/datepicker/example-index.html?locale=fi-FI
2) type Locale.setLanguage('sv') in the console

Then the format of the datefield will be in sv as well the calendar information but the rest of the text is fi-FI. The reason is that calendar names ect are part of the locale information not part of the language information. So that makes it a bit wierd. if its needed to use a locale format different than the language then you can just set the language and locale to the same thing and then set the dateFormat setting to finish.

I think to do that so that the locale and calendar is different would need to move the translations out of the locale for the calendar. So seperate new issue? Or critical to patch in 4.21.x? Seems to big to me.

@volante007 maybe ping me on teams and we can discuss how your using this and if that part should change or not. Also if this is fixed your case enough to patch or more work needed now or in the future? As of now with datePicker you can set locale and that makes the most sense. Changing language on that one would give a wierd mix.

As discussed I'll create a separate report for the locale/language mix in the datepicker and we'll leave that out of the patch

I fixed this issue and merged it to both 4.22 final and 4.21.3 as a patch
https://www.npmjs.com/package/ids-enterprise/v/4.21.3

Hope it helps!

Was this page helpful?
0 / 5 - 0 ratings