[i18n] Replace hardcoded messages for Data import (#6795)

* localize confirm import message

* localize error messages
This commit is contained in:
Fabi 2025-11-28 08:43:06 +01:00 committed by GitHub
parent c945a1b3f9
commit 4522e9e593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1446,18 +1446,10 @@ export class GameData {
globalScene.ui.showText(error, null, () => globalScene.ui.showText("", 0), fixedInt(1500));
if (!valid) {
return globalScene.ui.showText(
`Your ${dataName} data could not be loaded. It may be corrupted.`,
null,
() => globalScene.ui.showText("", 0),
fixedInt(1500),
);
return displayError(i18next.t("menuUiHandler:importCorrupt", { dataName }));
}
globalScene.ui.showText(
`Your ${dataName} data will be overridden and the page will reload. Proceed?`,
null,
() => {
globalScene.ui.showText(i18next.t("menuUiHandler:confirmImport", { dataName }), null, () => {
globalScene.ui.setOverlayMode(
UiMode.CONFIRM,
() => {
@ -1466,9 +1458,7 @@ export class GameData {
if (!bypassLogin && dataType < GameDataType.SETTINGS) {
updateUserInfo().then(success => {
if (!success[0]) {
return displayError(
`Could not contact the server. Your ${dataName} data could not be imported.`,
);
return displayError(i18next.t("menuUiHandler:importNoServer", { dataName }));
}
const { trainerId, secretId } = this;
let updatePromise: Promise<string | null>;
@ -1491,9 +1481,7 @@ export class GameData {
updatePromise.then(error => {
if (error) {
console.error(error);
return displayError(
`An error occurred while updating ${dataName} data. Please contact the administrator.`,
);
return displayError(i18next.t("menuUiHandler:importError", { dataName }));
}
window.location.reload();
});
@ -1509,8 +1497,7 @@ export class GameData {
false,
-98,
);
},
);
});
};
})((e.target as any).files[0]);