This commit is contained in:
2019-04-08 20:10:57 +00:00
parent 3ee2909ed5
commit 12471f3090
2 changed files with 10 additions and 4 deletions

View File

@@ -4,10 +4,17 @@ import locale from "./locale";
var devModeShowErrors = false; var devModeShowErrors = false;
//TODO: tie this into form error display somehow so that form can control whether to show particular error or not ////////////////////////////////////////////////////////
//i.e. dealwitherror(msg,formerrordisplayfunction,bool shouldshowError) //
// Log and optionally display errors
//
function dealWithError(msg, displayToUser) { function dealWithError(msg, displayToUser) {
msg = locale.translateString(msg); msg = locale.translateString(msg);
//In some cases the error may not be localizable, if this is not a debug run then it should show without the ?? that localizing puts in keys not found
//so it's not as wierd looking to the user
if (!devModeShowErrors && msg.includes("??")) {
msg = msg.replace("??", "");
}
store.commit("logItem", msg); store.commit("logItem", msg);
if (displayToUser || devModeShowErrors) { if (displayToUser || devModeShowErrors) {
alert("~" + msg); alert("~" + msg);

View File

@@ -7,7 +7,7 @@ export default {
get(key) { get(key) {
// debugger; // debugger;
if (!_.has(store.state.localeText, key)) { if (!_.has(store.state.localeText, key)) {
return "?" + key + "?"; return "??" + key;
} }
return store.state.localeText[key]; return store.state.localeText[key];
}, },
@@ -128,7 +128,6 @@ export default {
var foundMatch = match[0]; var foundMatch = match[0];
var ltKey = match[1]; var ltKey = match[1];
var newValue = this.get(ltKey); var newValue = this.get(ltKey);
ret = ret.replace(foundMatch, newValue); ret = ret.replace(foundMatch, newValue);
} }
return ret; return ret;