fix: run without locales present (#4539)

some code was hard-wired with  locales having to be present. This is no longer the case now
This commit is contained in:
flx-sta 2024-10-01 15:24:53 -07:00 committed by GitHub
parent c8c7b0e1f7
commit 0c5e69e1da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -217,7 +217,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
{ multiplier: multiplierOne, description: `25 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.GOLDEN) }
];
const resolvedLanguage = i18next.resolvedLanguage!; // TODO: is this bang correct?
const resolvedLanguage = i18next.resolvedLanguage ?? "en"; // TODO: is this bang correct?
const pullOptionsText = pullOptions.map(option =>{
const desc = option.description.split(" ");
if (desc[0].length < 2) {

View File

@ -358,8 +358,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
setup() {
const ui = this.getUi();
const currentLanguage = i18next.resolvedLanguage!; // TODO: is this bang correct?
const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang))!; // TODO: is this bang correct?
const currentLanguage = i18next.resolvedLanguage ?? "en"; // TODO: is this bang correct?
const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang)) ?? "en"; // TODO: is this bang correct?
const textSettings = languageSettings[langSettingKey];
this.starterSelectContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);

View File

@ -17,8 +17,8 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
setup() {
super.setup();
const flattenKeys = (object, topKey?: string, midleKey?: string[]): Array<any> => {
return Object.keys(object).map((t, i) => {
const flattenKeys = (object?: any, topKey?: string, midleKey?: string[]): Array<any> => {
return Object.keys(object ?? {}).map((t, i) => {
const value = Object.values(object)[i];
if (typeof value === "object" && !isNullOrUndefined(value)) { // we check for not null or undefined here because if the language json file has a null key, the typeof will still be an object, but that object will be null, causing issues