This commit is contained in:
2020-12-09 21:44:16 +00:00
parent 8f96103e67
commit b89daa8913
2 changed files with 13 additions and 11 deletions

View File

@@ -70,6 +70,9 @@ export default {
}
},
get(key) {
if (!key) {
return "??NO_TRANSLATION_KEY";
}
//no translation for Wiki
if (key == "Wiki") {
return "Wiki";
@@ -205,6 +208,7 @@ export default {
"SelectedItems",
"AllItemsInList",
"NoData",
"Errors",
"ErrorFieldLengthExceeded",
"ErrorStartDateAfterEndDate",
"ErrorRequiredFieldEmpty",
@@ -288,23 +292,19 @@ export default {
//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;
console.log("#### START OF translateString:", s);
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);
}