Change of localisation at runtime


#1

Hi Julian, hi everyone,

I started playing with LocalisedStrings in my app and encountered a problem when trying to change the localisation at runtime:

I can’t find a way to trigger a repaint of the whole app so that every displayed text can be updated with the new translation…

Any idea ?

(I noticed Tracktion requires a restart for that…)

Thanx in advance !


#2

Calling the setCurrentMappings() would do the trick, wouldn’t it?

Of course, it’d be up to you to do any repainting, or refreshing of text that your app would need.


#3

Of course setCurrentMappings() changes the current mapping in the LocalisedStrings instance but i was wondering if there was a way to force the whole app to repaint itself in one shot instead of calling repaint() on every concerned component…?


#4

If that’s all you need, just do a repaint of the top-level window.


#5

In fact, i had tried this but it seemed not to work with my MenuBarComponent…
I just realized menu bar texts had to be invalidated by calling MenuBarModel::menuItemsChanged() ! Sorry for the inconvenience :slight_smile:

And what about any other TopLevelWindow (e.g. AlertWindow or DialogWindow) which can be displayed when changing of language? No other way than calling repaint on each one ?

Anyway, thanx for your answer !


#6

Not much point calling repaint on an AlertWindow, you’d need give it an updated string to display. Likewise a lot of components that just show some text that you’ve previously given it.