On 9/20/2015 02:44, Adrien Destugues wrote:
Only the FirstBootPrompt application will use the message to refresh all its text when you select a different language.
There is no locale library anymore (it is all included in libbe now).
The lookup in the catalogs being somewhat slow, the Locale Kit is designed to do it only once when B_TRANSLATE is called (usually when setting the label of a view). Then, the localized string is passed to the BView or whatever uses it. Handling locale changes in a way that's transparent to the application would mean storing the english string in the BControl, alongside with a handle to the BCatalog to use (which is usually the application MIME type, but can be something else if the application uses custom catalogs or the text comes from a library). Since the handle to the BCatalog would be shared between all views used in the application, I'm not sure when the old catalog could be safely destroyed. And finally, the application may still need to refresh other things: the window layout, any loaded resources (let's say if the app also has localized sound or pictures), and any instances of BCollator (for sorting text), B*Format, etc. And I'm not even talking about switching between RTL and LTR languages, which we don't support yet, or changing between languages which need different fonts to display properly.We can, however, have generic solutions for color and font changes. ForI'm not sure it's possible to make this transparent to the app.
color, of course, we will have to ensure each view is using the previous
view color - no such worries for controls :p.
In BControl views, there are also cases where
custom drawing is used. I'm thinking of a BList with custom subclasses
of BListItem (examples in Media and Locale prefs to add icons to the
items, and in Paladin to colorize items depending on their compilation
state), a BMenu with custom BMenuItems (Tracker adds icons to its menu
item, I have a work in progress app using a BSlider inside a BMenuItem,
and other combinations can be created). In these cases the app, or maybe
the custom controls, will have to take care of adjusting to the changes.
So, +1 to having a notification message when the settings are changed (I
think a single message with bitmask is a good compromise, because an app
can decide to refresh its whole UI only once when several settings are
changed at the same time). +1 to having the UI auto-adjust to it in the
cases where there aren't compatibility problems with doing so (at least
changing the decorator color will be fine - for the other changes I'm
not so sure, it will require some testing).