This commit is contained in:
@@ -19,7 +19,7 @@ async function dealWithError(msg, vm) {
|
||||
lastMessageTimeStamp = new Date();
|
||||
|
||||
//translate as necessary
|
||||
msg = await window.$gz.translation.translateStringWithMultipleKeys(msg);
|
||||
msg = await window.$gz.translation.translateStringWithMultipleKeysAsync(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
|
||||
|
||||
@@ -654,16 +654,14 @@ export default {
|
||||
ve.error +
|
||||
"]";
|
||||
if (ve.message) {
|
||||
//NOTE: This is (**still not**) how to handle calling an async function from a sync function
|
||||
//for reference sync async function async method from sync method
|
||||
//it just can't be done and this needs to go away and not be expected to do this
|
||||
let transMessage = ve.message;
|
||||
window.$gz.translation
|
||||
.translateStringWithMultipleKeys(ve.message)
|
||||
.then(result => {
|
||||
transMessage = result;
|
||||
});
|
||||
fldErr += ' - "' + transMessage + '"';
|
||||
//NOTE: call sync version here as can't call async code from here
|
||||
//so translations must already be pre-fetched to work here
|
||||
fldErr +=
|
||||
' - "' +
|
||||
window.$gz.translation.translateStringWithMultipleKeys(
|
||||
ve.message
|
||||
) +
|
||||
'"';
|
||||
ret.push(fldErr);
|
||||
} else {
|
||||
ret.push(fldErr);
|
||||
|
||||
@@ -301,7 +301,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 translateStringWithMultipleKeys(s) {
|
||||
async translateStringWithMultipleKeysAsync(s) {
|
||||
let ret = s;
|
||||
let found = s.match(/LT:[\w]*/gm);
|
||||
if (found == null) {
|
||||
@@ -324,6 +324,26 @@ export default {
|
||||
|
||||
return ret;
|
||||
},
|
||||
////////////////////////////////////////////////////////
|
||||
// Take in a string that contains one or more
|
||||
//translation keys that start with LT:
|
||||
//translate each and replace and return the string translated
|
||||
// (DOES NOT fetch and cache any missing strings, they must exist)
|
||||
//this is the sync version to be used in non async capable code
|
||||
translateStringWithMultipleKeys(s) {
|
||||
let ret = s;
|
||||
let found = s.match(/LT:[\w]*/gm);
|
||||
if (found == null) {
|
||||
return ret;
|
||||
}
|
||||
//replace
|
||||
found.forEach(z => {
|
||||
let translated = this.get(z.replace("LT:", ""));
|
||||
//replace all
|
||||
ret = ret.split(z).join(translated);
|
||||
});
|
||||
return ret;
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// dynamically set the vuetify language elements from
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
this.languageName,
|
||||
this.hour12
|
||||
),
|
||||
status: await window.$gz.translation.translateStringWithMultipleKeys(
|
||||
status: await window.$gz.translation.translateStringWithMultipleKeysAsync(
|
||||
o.statusText
|
||||
),
|
||||
jobId:
|
||||
|
||||
@@ -97,7 +97,7 @@ export default {
|
||||
res.data.forEach(function appendImportResultItem(value) {
|
||||
outText += value + "\n";
|
||||
});
|
||||
vm.importResult = await window.$gz.translation.translateStringWithMultipleKeys(
|
||||
vm.importResult = await window.$gz.translation.translateStringWithMultipleKeysAsync(
|
||||
outText
|
||||
);
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ export default {
|
||||
);
|
||||
temp[
|
||||
i
|
||||
].name = await window.$gz.translation.translateStringWithMultipleKeys(
|
||||
].name = await window.$gz.translation.translateStringWithMultipleKeysAsync(
|
||||
temp[i].name
|
||||
);
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
this.languageName,
|
||||
this.hour12
|
||||
),
|
||||
status: await window.$gz.translation.translateStringWithMultipleKeys(
|
||||
status: await window.$gz.translation.translateStringWithMultipleKeysAsync(
|
||||
o.statusText
|
||||
),
|
||||
jobId:
|
||||
|
||||
Reference in New Issue
Block a user