mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-18 12:39:19 -06:00
Broadcast when the language changes
This is left open to future additions, by naming it 'locale', and having the language just be an object field. Side note, maybe we should have a LocaleService for this?
This commit is contained in:
@@ -722,7 +722,14 @@ window.mutate_user_preferences = function(user_preferences_delta) {
|
||||
window.update_user_preferences = function(user_preferences) {
|
||||
window.user_preferences = user_preferences;
|
||||
localStorage.setItem('user_preferences', JSON.stringify(user_preferences));
|
||||
window.locale = user_preferences.language ?? 'en';
|
||||
const language = user_preferences.language ?? 'en';
|
||||
window.locale = language;
|
||||
|
||||
// Broadcast locale change to apps
|
||||
const broadcastService = globalThis.services.get('broadcast');
|
||||
broadcastService.sendBroadcast('localeChanged', {
|
||||
language: language,
|
||||
}, { sendToNewAppInstances: true });
|
||||
}
|
||||
|
||||
window.sendWindowWillCloseMsg = function(iframe_element) {
|
||||
|
||||
Reference in New Issue
Block a user