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:
parent
c8c7b0e1f7
commit
0c5e69e1da
|
@ -217,7 +217,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||||
{ multiplier: multiplierOne, description: `25 ${i18next.t("egg:pulls")}`, icon: getVoucherTypeIcon(VoucherType.GOLDEN) }
|
{ 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 pullOptionsText = pullOptions.map(option =>{
|
||||||
const desc = option.description.split(" ");
|
const desc = option.description.split(" ");
|
||||||
if (desc[0].length < 2) {
|
if (desc[0].length < 2) {
|
||||||
|
|
|
@ -358,8 +358,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const ui = this.getUi();
|
const ui = this.getUi();
|
||||||
const currentLanguage = i18next.resolvedLanguage!; // 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))!; // 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];
|
const textSettings = languageSettings[langSettingKey];
|
||||||
|
|
||||||
this.starterSelectContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
|
this.starterSelectContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6);
|
||||||
|
|
|
@ -17,8 +17,8 @@ export default class TestDialogueUiHandler extends FormModalUiHandler {
|
||||||
setup() {
|
setup() {
|
||||||
super.setup();
|
super.setup();
|
||||||
|
|
||||||
const flattenKeys = (object, topKey?: string, midleKey?: string[]): Array<any> => {
|
const flattenKeys = (object?: any, topKey?: string, midleKey?: string[]): Array<any> => {
|
||||||
return Object.keys(object).map((t, i) => {
|
return Object.keys(object ?? {}).map((t, i) => {
|
||||||
const value = Object.values(object)[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
|
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
|
||||||
|
|
Loading…
Reference in New Issue