This commit is contained in:
2020-12-10 18:03:00 +00:00
parent a3756f93ac
commit acae28ffc4
7 changed files with 20 additions and 32 deletions

View File

@@ -6,7 +6,7 @@ let lastMessageTimeStamp = new Date();
//
// translate, Log and optionally display errors
// return translated message in case caller needs it
function dealWithError(msg, vm) {
async function dealWithError(msg, vm) {
//Check if this is the same message again as last time within a short time span to avoid endless looping errors of same message
//but still allow for user to repeat operation that causes error so they can view it
let newHash = window.$gz.util.quickHash(msg);
@@ -19,7 +19,7 @@ function dealWithError(msg, vm) {
lastMessageTimeStamp = new Date();
//translate as necessary
msg = window.$gz.translation.translateString(msg);
msg = await window.$gz.translation.translateStringWithMultipleKeys(msg);
//In some cases the error may not be translatable, if this is not a debug run then it should show without the ?? that translating puts in keys not found
//so it's not as weird looking to the user

View File

@@ -685,10 +685,15 @@ export default {
ve.error +
"]";
if (ve.message) {
if (ve.message.includes("LT:")) {
ve.message = vm.$ay.t(ve.message.split(":")[1]);
}
fldErr += ' - "' + ve.message + '"';
// if (ve.message.includes("LT:")) {
// ve.message = vm.$ay.t(ve.message.split(":")[1]);
// }
fldErr +=
' - "' +
window.$gz.translation.translateStringWithMultipleKeys(
ve.message
) +
'"';
}
ret.push(fldErr);
});

View File

@@ -291,7 +291,7 @@ export default {
//translation keys that start with LT:
//translate each and replace and return the string translated
// (fetch and cache any missing strings)
async translateString(s) {
async translateStringWithMultipleKeys(s) {
let ret = s;
let found = s.match(/LT:[\w]*/gm);
if (found == null) {