This commit is contained in:
2020-12-10 15:17:50 +00:00
parent b89daa8913
commit 0ae8266a8e

View File

@@ -293,21 +293,42 @@ export default {
//
translateString(s) {
console.log("#### START OF translateString:", s);
/*Error processing item 7: LT:Errors
LT:ErrorAPI2208 ,LT:Customer
*/
// let regex = new RegExp(/\bLT:[a-zA-Z]*\b/g, "m");
// let regex = /\bLT:[a-zA-Z]*\b/g;
let ret = s;
let pattern = /\bLT:[a-zA-Z]*\b/g;
let match;
This is fucked, maybe change it, not sure what the fuck it's doing actually it doesn't seem to be iterating each key
//seems to be missing shit, not right, missses if start of string, matches just LT: by itself for some reason...meh
while ((match = pattern.exec(s)) != null) {
console.log("Match: ", match);
let foundMatch = match[0];
let tKey = match[1];
console.log("Geting value for key:", tKey);
let newValue = this.get(tKey);
ret = ret.replace(foundMatch, newValue);
let found = s.match(/LT:[\w]*/gm);
if (found == null) {
return ret;
}
found.forEach(z => {
console.log("Geting value for key:", z);
let translated = this.get(z.replace("LT:", ""));
console.log("Translated:", translated);
//replace all
ret = ret.split(z).join(translated);
});
// console.log("found", found);
// //-------------
// let ret = s;
// // let pattern = /\bLT:[a-zA-Z]*\b/g;
// let pattern = /LT:[\w]*/gm;
// let match;
// while ((match = pattern.exec(s)) != null) {
// console.log("Match: ", match);
// let foundMatch = match[0];
// let tKey = match[1];
// console.log("Geting value for key:", tKey);
// let newValue = this.get(tKey);
// ret = ret.replace(foundMatch, newValue);
// }
return ret;
// const regex = /\bLT:[a-zA-Z]*\b/g;
// const found = stringtosearch.match(regex);