From b89daa8913e7e1b1c36b03eff06f0d5d0f525375 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 9 Dec 2020 21:44:16 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 2 ++ ayanova/src/api/translation.js | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 57424733..bf0cb887 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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 diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index a99c7c8f..54e2bc69 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -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); }