Skip to content

Commit

Permalink
fix: run without locales present
Browse files Browse the repository at this point in the history
some code was hard-wired with  locales having to be present. This is no longer the case now
  • Loading branch information
flx-sta committed Oct 1, 2024
1 parent c8c7b0e commit fe253f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ui/egg-gacha-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/test-dialogue-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe253f3

Please sign in to comment.