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

@@ -5,6 +5,8 @@
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

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);
}