This commit is contained in:
2019-04-08 17:41:51 +00:00
parent 83f5df92ab
commit 6e3669ad7c
3 changed files with 20 additions and 2 deletions

View File

@@ -1,9 +1,13 @@
/* Xeslint-disable */
import store from "../store";
import locale from "./locale";
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)
function dealWithError(msg) {
msg = locale.translateString(msg);
store.commit("logItem", msg);
if (devModeShowErrors) {
alert("Error: " + msg);

View File

@@ -3,7 +3,7 @@ import store from "../store";
import router from "../router";
import auth from "./auth";
import errorHandler from "./errorhandler";
import locale from "./locale";
function stringifyPrimitive(v) {
switch (typeof v) {

View File

@@ -114,5 +114,19 @@ export default {
shortDateAndTime: "YYYY-MM-DD hh:mm:ss A"
},
//timeZoneOffset is in decimal hours
timeZoneOffset: -8.0
timeZoneOffset: -8.0,
////////////////////////////////////////////////////////
// Take in a string that contains one or more
//locale keys between square brackets
//translate each and return the string translated
//
translateString(s) {
var ret = s;
var pattern = /\[(.*?)\]/g;
var match;
while ((match = pattern.exec(s)) != null) {
ret.replace(match, this.get(match));
}
return ret;
}
};