pokerogue/src/ui/settings/settings-display-ui-handler.ts
NightKev 0107b1d47e
[Refactor] Create global scene variable (#4766)
* Replace various `scene` pass-arounds with global scene variable

* Modify tests

* Add scene back to `fade[in|out]()` calls

Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>

* Fix Bug Superfan ME test

Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>

* Re-enable fixed test

Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>

* Rename `gScene` to `globalScene`

* Move `globalScene` to its own file to fix import/async issues

* Fix `SelectModifierPhase` tests

* Fix ME tests by removing `scene` from `expect()`s

* Resolve merge issues

* Remove tsdocs referencing `scene` params

Remove missed instances of `.scene`

* Remove unnecessary `globalScene` usage in `loading-scene.ts`

* Fix merge conflicts

* Attempt to fix circular import issue

* Found the source of the import issue

* Fix merge issues

---------

Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
2025-01-12 15:33:05 -08:00

103 lines
2.9 KiB
TypeScript

import type { Mode } from "../ui";
import AbstractSettingsUiHandler from "./abstract-settings-ui-handler";
import { SettingKeys, SettingType } from "#app/system/settings/settings";
"#app/inputs-controller";
export default class SettingsDisplayUiHandler extends AbstractSettingsUiHandler {
/**
* Creates an instance of SettingsGamepadUiHandler.
*
* @param mode - The UI mode, optional.
*/
constructor(mode: Mode | null = null) {
super(SettingType.DISPLAY, mode);
this.title = "Display";
/**
* Update to current language from default value.
* - default value is 'English'
*/
const languageIndex = this.settings.findIndex(s => s.key === SettingKeys.Language);
if (languageIndex >= 0) {
const currentLocale = localStorage.getItem("prLang");
switch (currentLocale) {
case "en":
this.settings[languageIndex].options[0] = {
value: "English",
label: "English",
};
break;
case "es-ES":
this.settings[languageIndex].options[0] = {
value: "Español (ES)",
label: "Español (ES)",
};
break;
case "it":
this.settings[languageIndex].options[0] = {
value: "Italiano",
label: "Italiano",
};
break;
case "fr":
this.settings[languageIndex].options[0] = {
value: "Français",
label: "Français",
};
break;
case "de":
this.settings[languageIndex].options[0] = {
value: "Deutsch",
label: "Deutsch",
};
break;
case "pt-BR":
this.settings[languageIndex].options[0] = {
value: "Português (BR)",
label: "Português (BR)",
};
break;
case "zh-CN":
this.settings[languageIndex].options[0] = {
value: "简体中文",
label: "简体中文",
};
break;
case "zh-TW":
this.settings[languageIndex].options[0] = {
value: "繁體中文",
label: "繁體中文",
};
break;
case "ko":
case "ko-KR":
this.settings[languageIndex].options[0] = {
value: "한국어",
label: "한국어",
};
break;
case "ja":
this.settings[languageIndex].options[0] = {
value: "日本語",
label: "日本語",
};
break;
case "ca-ES":
this.settings[languageIndex].options[0] = {
value: "Català",
label: "Català",
};
break;
default:
this.settings[languageIndex].options[0] = {
value: "English",
label: "English",
};
break;
}
}
this.localStorageKey = "settings";
}
}