return boolean from changing locale
parent
2a32189ea1
commit
6a6c8f0fd9
|
@ -178,11 +178,17 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||||
scene.ui.revertMode();
|
scene.ui.revertMode();
|
||||||
(scene.ui.getHandler() as SettingsUiHandler).setOptionCursor(Object.values(Setting).indexOf(Setting.Language), 0, true);
|
(scene.ui.getHandler() as SettingsUiHandler).setOptionCursor(Object.values(Setting).indexOf(Setting.Language), 0, true);
|
||||||
};
|
};
|
||||||
const changeLocaleHandler = (locale: string) => {
|
const changeLocaleHandler = (locale: string): boolean => {
|
||||||
i18next.changeLanguage(locale);
|
try {
|
||||||
localStorage.setItem('prLang', locale);
|
i18next.changeLanguage(locale);
|
||||||
cancelHandler();
|
localStorage.setItem('prLang', locale);
|
||||||
scene.reset(true, false, true);
|
cancelHandler();
|
||||||
|
scene.reset(true, false, true);
|
||||||
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error changing locale:', error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||||
options: [
|
options: [
|
||||||
|
|
Loading…
Reference in New Issue