Opened 11 years ago

Last modified 19 months ago

#7819 assigned enhancement

Instant change of locale

Reported by: deejam Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Locale Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

When changing locale, applications should instantly redraw using the newly selected locale. In the current implementation, applications needs to be manually restarted before the new locale is activated.

Change History (10)

comment:1 by anevilyak, 11 years ago

Component: Servers/app_serverKits/Locale Kit
Owner: changed from axeld to pulkomandy
Summary: [app_server] Instant change of localeInstant change of locale

That actually has nothing to do with the app_server ; redrawing isn't the problem, the app needs to be notified that the locale has changed so it can adapt (i.e. update the strings used on widgets, etc.). I don't recall if such a notification is sent already or not, but if it is then it's mostly a matter of updating the apps to react appropriately.

comment:2 by pulkomandy, 11 years ago

Apps need to listen to the B_LOCALE_CHANGED message, as defined in LocaleRoster.h. It is sent by MutableLocaleRoster on settings change, so app just have to listen to it.

Last edited 11 years ago by pulkomandy (previous) (diff)

comment:3 by pulkomandy, 11 years ago

Owner: changed from pulkomandy to nobody
Status: newassigned

comment:4 by diver, 11 years ago

This feature would be very useful for those who do localization. And it's a really nice feature overall.

comment:5 by pulkomandy, 11 years ago

The feature is working already. When changing locale, all applications get the B_LOCALE_CHANGED message and they have to reload thir catalog. ReadOnlyBootPrompt is a good example on how to relad a catalog.

in reply to:  5 comment:6 by deejam, 11 years ago

Replying to pulkomandy:

The feature is working already. When changing locale, all applications get the B_LOCALE_CHANGED message and they have to reload thir catalog. ReadOnlyBootPrompt is a good example on how to relad a catalog.

Is it possible to implement a method in the appropriate kit that listens to B_LOCALE_CHANGED and make the change per default? If application developers do not want that to happen, they can override the method.

comment:7 by pulkomandy, 11 years ago

No. The locale kit can't track what you do with the strings you requested from it. So you have to tell all your views to refresh, or refresh your textmode display for CLI apps, or whatever. This needs careful coding because you must make sure you don't query for a string using B_TRANSLATE while you're in the process of switching catalogs. Whike it is possible to make sure this doesn't happen with locking on every B_TRANSLATE call, the result would be an even slower locale kit. Not really a nice idea. So, it's up to the application to handle that when it can do it safely.

comment:8 by pulkomandy, 7 years ago

Milestone: R1Unscheduled

comment:9 by bitigchi, 19 months ago

Upon changing the "primary locale", an alert window would be useful for nice UX, saying that the primary locale has been changed, and you might want to restart for changes to completely take effect.

Other than that, instant locale change is nice to have, but not paramount I think. A restart would always be better to make sure everything is properly initialised.

comment:10 by pulkomandy, 19 months ago

What is this, windows 95?

We should make this work live. It's not too convenient with the current API, but it's possible. Or we may decide that we prefer to wait until we change the API to make it simpler for developers.

In any case, there is no reason to restrart the whole system for a change of locale. We could consider restarting deskbar and tracker, maybe, since this can usually be done without too much problems (we have to be careful on checking if there are file copies or other operations in progress however).

Note: See TracTickets for help on using tickets.