aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/components/ThunderstoreModCard.vue
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-06-12 22:43:08 +0200
committerGitHub <noreply@github.com>2023-06-12 22:43:08 +0200
commitaa8c8377edd69dc5ac50441ec2816b5711d0e128 (patch)
tree215c0a71b1d535b16e07be1f0df99cbcaf451499 /src-vue/src/components/ThunderstoreModCard.vue
parenta0e2c296ef6161bf5b26a2bde04d209755727025 (diff)
downloadFlightCore-aa8c8377edd69dc5ac50441ec2816b5711d0e128.tar.gz
FlightCore-aa8c8377edd69dc5ac50441ec2816b5711d0e128.zip
fix: Display install messages even outside mod view (#391)
Diffstat (limited to 'src-vue/src/components/ThunderstoreModCard.vue')
-rw-r--r--src-vue/src/components/ThunderstoreModCard.vue10
1 files changed, 8 insertions, 2 deletions
diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue
index c25b19a2..2fbbac40 100644
--- a/src-vue/src/components/ThunderstoreModCard.vue
+++ b/src-vue/src/components/ThunderstoreModCard.vue
@@ -251,8 +251,11 @@ export default defineComponent({
this.isBeingInstalled = true;
}
- await invoke<string>("install_mod_caller", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => {
- showNotification(this.$t('mods.card.install_success', { modName: mod.name }), message);
+ // Capture translation method in a context, so it can be used outside Vue component context.
+ // (see https://github.com/R2NorthstarTools/FlightCore/issues/384)
+ (async (translate: Function) => {
+ await invoke<string>("install_mod_caller", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => {
+ showNotification(translate('mods.card.install_success', { modName: mod.name }), message);
})
.catch((error) => {
showErrorNotification(error);
@@ -262,6 +265,9 @@ export default defineComponent({
this.isBeingUpdated = false;
this.$store.commit('loadInstalledMods');
});
+ // @ts-ignore
+ })(this.$i18n.t);
+
},
}
});