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

@@ -1,5 +1,7 @@
Grab bag stuff that didn't fit into official TODO
todo: Look for english text at server and client source code and change it all to translation keys
todo: Users / Contacts lists not reportable from main UI
not using regular DataList for user lists and contact lists?
currently not reportable as a list easily since not a GZDataList but could probably rectify that even without switching to datalist

View File

@@ -5,30 +5,7 @@
MISC ITEMS THAT CAME UP
todo: CURRENTLY - translation code not working, possibly regex fucked, play with it
also it needs to fetch any thing it doesn't already have so it needs to prepare for that by compiling all the keys, attempting to cache them first then doing the rest
todo: Client all LT: error and message processing:
convention is always capitalized LT: followed by a unbroken string of text
It should *replace* the LT:string with the translation but keep the entire rest of the string
so instead of how it currently splits and expects one lt in the string instead it should use a regex (I know)
and get antying that is LT:toendoftextcharacts, translate it, then replace it in the string
This should be centralized and then can be used by error processor as well as extension error processor etc
basically the error to human string code should handle all this
Test with headoffice bulk delete
{"data":[
{"created":"2020-12-09T20:11:53.832772Z","statusText":"Processing job \"Bulk operation: DELETE on HeadOffice (2 specified) - BulkCoreBizObjectOperation:Delete\"","jobId":"3297acfa-cc30-403a-a6aa-f816a93213c9"},{"created":"2020-12-09T20:11:53.855505Z","statusText":"Bulk job Delete started...","jobId":"3297acfa-cc30-403a-a6aa-f816a93213c9"},
{"created":"2020-12-09T20:11:53.898064Z","statusText":"Error processing item 9: LT:Errors\r\nLT:ErrorAPI2208 ,LT:Customer\r\n","jobId":"3297acfa-cc30-403a-a6aa-f816a93213c9"},
{"created":"2020-12-09T20:11:53.905044Z","statusText":"Error processing item 4: LT:Errors\r\nLT:ErrorAPI2208 ,LT:Customer\r\n","jobId":"3297acfa-cc30-403a-a6aa-f816a93213c9"},
{"created":"2020-12-09T20:11:53.910072Z","statusText":"Bulk job Delete processed 2 of 2 with 2 failures","jobId":"3297acfa-cc30-403a-a6aa-f816a93213c9"}]}
AREAS_TO_CHANGE:
gzform.js line 688 LT:
translation.js
const regex = /\bLT:[a-zA-Z]*\b/g;
const found = stringtosearch.match(regex);
found=array of strings
todo: Job logs should all process the status text through a LT: translator as the changes above will cause them to log as LT and no longer with english

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) {

View File

@@ -104,7 +104,9 @@ export default {
this.languageName,
this.hour12
),
status: await window.$gz.translation.translateString(o.statusText),
status: await window.$gz.translation.translateStringWithMultipleKeys(
o.statusText
),
jobId:
o.jobId == "00000000-0000-0000-0000-000000000000" ? "" : o.jobId
});

View File

@@ -117,7 +117,9 @@ export default {
this.languageName,
this.hour12
),
status: o.statusText,
status: await window.$gz.translation.translateStringWithMultipleKeys(
o.statusText
),
jobId:
o.jobId == "00000000-0000-0000-0000-000000000000"
? ""