mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00: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:
parent
59cdb6e8c6
commit
84a31b3520
@ -722,7 +722,14 @@ window.mutate_user_preferences = function(user_preferences_delta) {
|
|||||||
window.update_user_preferences = function(user_preferences) {
|
window.update_user_preferences = function(user_preferences) {
|
||||||
window.user_preferences = user_preferences;
|
window.user_preferences = user_preferences;
|
||||||
localStorage.setItem('user_preferences', JSON.stringify(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) {
|
window.sendWindowWillCloseMsg = function(iframe_element) {
|
||||||
|
Loading…
Reference in New Issue
Block a user