diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index bbbc2eb9..57424733 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -20,6 +20,14 @@ todo: Client all LT: error and message processing: {"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 diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index f6b762c1..7b26a85c 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -57,7 +57,7 @@ function handleError(action, error, route) { ); router.push(window.$gz.store.state.homePage); - throw new Error("[ErrorUserNotAuthorized]"); + throw new Error("LT:ErrorUserNotAuthorized"); } //Handle 401 not authenticated @@ -73,7 +73,7 @@ function handleError(action, error, route) { router.push("/login"); - throw new Error("[ErrorUserNotAuthenticated]"); + throw new Error("LT:ErrorUserNotAuthenticated"); } //is it a network error? @@ -111,11 +111,11 @@ export default { status(response) { //Handle expected api errors if (response.status == 401) { - throw new Error("[ErrorUserNotAuthenticated]"); + throw new Error("LT:ErrorUserNotAuthenticated"); } if (response.status == 403) { - throw new Error("[ErrorUserNotAuthorized]"); + throw new Error("LT:ErrorUserNotAuthorized"); } //404 not found is an expected status not worth logging allow to bubble up @@ -150,11 +150,11 @@ export default { statusEx(response) { //Handle expected api errors if (response.status == 401) { - throw new Error("[ErrorUserNotAuthenticated]"); + throw new Error("LT:ErrorUserNotAuthenticated"); } if (response.status == 403) { - throw new Error("[ErrorUserNotAuthorized]"); + throw new Error("LT:ErrorUserNotAuthorized"); } //404 not found is an expected status not worth logging allow to bubble up diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index 2954ef9e..a99c7c8f 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -284,12 +284,23 @@ export default { //////////////////////////////////////////////////////// // Take in a string that contains one or more - //translation keys between square brackets - //translate each and return the string translated + //translation keys that start with LT: + //translate each and replace and return the string translated // translateString(s) { + // let ret = s; + // let pattern = /\[(.*?)\]/g; + // let match; + // while ((match = pattern.exec(s)) != null) { + // let foundMatch = match[0]; + // let tKey = match[1]; + // let newValue = this.get(tKey); + // ret = ret.replace(foundMatch, newValue); + // } + // return ret; + let ret = s; - let pattern = /\[(.*?)\]/g; + let pattern = /\bLT:[a-zA-Z]*\b/g; let match; while ((match = pattern.exec(s)) != null) { let foundMatch = match[0]; @@ -298,6 +309,9 @@ export default { ret = ret.replace(foundMatch, newValue); } return ret; + // const regex = /\bLT:[a-zA-Z]*\b/g; + // const found = stringtosearch.match(regex); + // found=array of strings }, //////////////////////////////////////////////////////// diff --git a/ayanova/src/components/extensions-control.vue b/ayanova/src/components/extensions-control.vue index 430924f3..0c7c3f37 100644 --- a/ayanova/src/components/extensions-control.vue +++ b/ayanova/src/components/extensions-control.vue @@ -104,7 +104,7 @@ export default { this.languageName, this.hour12 ), - status: o.statusText, //todo: parse out LT:*text until non text character, replace that with localized + status: window.$gz.translation.translateString(o.statusText), jobId: o.jobId == "00000000-0000-0000-0000-000000000000" ? "" : o.jobId });