SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.95k stars 1.23k forks source link

Carousel forward/backward tooltips are localized to initially set language, not updated language #3656

Closed rg1 closed 1 year ago

rg1 commented 1 year ago

OpenUI5 version: 1.108.0 (but really any version that supports Carousel)

Browser/version (+device/version): any (tried Chrome and Firefox)

Any other tested browsers/devices(OK/FAIL): nope

URL (minimal example if possible): https://plnkr.co/edit/YCVZLAms72cm9oY8?preview

Steps to reproduce the problem:

  1. Open example above
  2. Switch UI5 language to one that is not your browser language
  3. Note how the localized text saying there are no table columns changes as expected
  4. Hover over right Carousel button. Note how the text is in your browser language (assuming it's supported).

What is the expected result?

Text for the Carousel buttons should be displayed in the language set for UI5, like all other messages (e.g. Table in the example)

What happens instead?

Text is localized to the browser language

Any other information? (attach screenshot if possible)

image

LidiyaGeorgieva commented 1 year ago

Hello @rg1 ,

I made simplified sample: https://plnkr.co/edit/TqMfy6BjSGXXMKvq And the Carousel arrows tooltips seems to work fine.

Best Regards, Lidiya

rg1 commented 1 year ago

@LidiyaGeorgieva So, I seem to be wrong about the browser language. Maybe it's the language initially set for UI5. After switching the language, the tooltips are off. Please reopen the bug.

LidiyaGeorgieva commented 1 year ago

Hello @rg1 ,

Please see the documentation for "setLanguage" method: https://sapui5.hana.ondemand.com/#/api/sap.ui.core.Configuration%23methods/setLanguage It is described, that: "The framework does not guarantee that already created, language dependent objects will be updated by this call. It therefore remains best practice for applications to switch the language early, e.g. before any language dependent objects are created. Applications that need to support more dynamic changes of the language should listen to the localizationChanged event and adapt all language dependent objects that they use (e.g. by rebuilding their UI)."

Best Regards, Lidiya

rg1 commented 1 year ago

@LidiyaGeorgieva You're correct, I did not see/remember, nor expect, that part of the documentation. Given that you're updating all the other language dependent strings I've encountered so far, I've come to expect this to work for native UI5 controls. Also, with this statement you're asking us to check every control we use. This makes me quite unhappy, but I guess I'll have to take it,

codeworrior commented 1 year ago

@rg1 this won't help you, but let me add some comments to complete the picture:

We discussed this feature already several times in the past (e.g. due to #2709, #1258, #741). But management decided that the use cases for a dynamic language change of an already created UI are too rare to justify the significant effort for a complete solution. For the known use cases, a change of the language + restart seemed to be acceptable, albeit not being optimal for the end user.

Some details reg. the necessary effort can be found around https://github.com/SAP/openui5/issues/2079#issuecomment-1058908149 .