Feat: Translate toast messages by adding msgi18n to callbacks (#3263)

* WIP: Add msgTranslated to callbacks

* Chore: Unify Saved period

* Feat: add support for interpolation
This commit is contained in:
Nelson Chan
2023-09-01 20:51:28 +08:00
committed by GitHub
parent 64b97c0f29
commit 52946c3e08
8 changed files with 28 additions and 10 deletions

View File

@@ -812,5 +812,6 @@
"showCertificateExpiry": "Show Certificate Expiry",
"noOrBadCertificate": "No/Bad Certificate",
"gamedigGuessPort": "Gamedig: Guess Port",
"gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server."
"gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server.",
"Saved.": "Saved."
}

View File

@@ -348,7 +348,7 @@
"Discard": "Odbaci",
"Cancel": "Otkaži",
"Powered by": "Pokreće",
"Saved": "Spremljeno",
"Saved.": "Spremljeno.",
"PushByTechulus": "Push by Techulus",
"GoogleChat": "Google Chat (preko platforme Google Workspace)",
"shrinkDatabaseDescription": "Pokreni VACUUM operaciju za SQLite. Ako je baza podataka kreirana nakon inačice 1.10.0, AUTO_VACUUM opcija već je uključena te ova akcija nije nužna.",

View File

@@ -730,5 +730,6 @@
"Invert Keyword": "以上關鍵字不能出現",
"Home": "首頁",
"Expected Value": "預期值",
"Json Query": "JSON 查询"
"Json Query": "JSON 查询",
"Saved.": "已儲存。"
}

View File

@@ -330,10 +330,19 @@ export default {
* @returns {void}
*/
toastRes(res) {
let msg = res.msg;
if (res.msgi18n) {
if (msg != null && typeof msg === "object") {
msg = this.$t(msg.key, msg.values);
} else {
msg = this.$t(msg);
}
}
if (res.ok) {
toast.success(res.msg);
toast.success(msg);
} else {
toast.error(res.msg);
toast.error(msg);
}
},