This commit is contained in:
@@ -762,12 +762,12 @@ export default function initialize() {
|
||||
//get language to use, try user set override first, if empty then browser set, if empty then default to en-us
|
||||
l.languageOverride =
|
||||
res.data.languageOverride ||
|
||||
window.$gz.translation.getBrowserFirstLanguage() ||
|
||||
window.$gz.locale.getBrowserFirstLanguage() ||
|
||||
"en-US";
|
||||
|
||||
l.timeZoneOverride =
|
||||
res.data.timeZoneOverride ||
|
||||
window.$gz.translation.getBrowserTimeZoneName() ||
|
||||
window.$gz.locale.getBrowserTimeZoneName() ||
|
||||
"America/New_York";
|
||||
|
||||
//No browser setting for this so meh
|
||||
|
||||
232
ayanova/src/api/locale.js
Normal file
232
ayanova/src/api/locale.js
Normal file
@@ -0,0 +1,232 @@
|
||||
/* ZZeslint-disable */
|
||||
//Browser Locale conversion utilities
|
||||
//dates,numbers currency etc
|
||||
export default {
|
||||
////////////////////////////////////////////////////////
|
||||
// attempt to determine user's preferred language settings
|
||||
// As of Jan 2020 all major browsers support
|
||||
// navigator.languages
|
||||
// but some use navigator.language (singular) to denote UI language preference
|
||||
// not browsing language preference
|
||||
// so the ideal way to do this is to use navigator.languages[0] for the preferred language
|
||||
// and ignore the singular property since we don't care about the actual browser UI language
|
||||
// only how the user expects to see the page itself
|
||||
//
|
||||
// also for sake of future proofing and edge cases need to have it be manually settable as well
|
||||
// ############### TODO: modify all of these to put the user's manual override first in line (if there is one)
|
||||
//https://appmakers.dev/bcp-47-language-codes-list/
|
||||
getBrowserLanguages() {
|
||||
return window.navigator.languages;
|
||||
},
|
||||
getBrowserFirstLanguage() {
|
||||
return window.navigator.languages[0];
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Get users default time zone
|
||||
//https://www.iana.org/time-zones
|
||||
//https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
getBrowserTimeZoneName() {
|
||||
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
},
|
||||
//////////////////////////////////////////////////
|
||||
// Get the user's chosen currency name
|
||||
//https://en.wikipedia.org/wiki/ISO_4217
|
||||
getCurrencyName() {
|
||||
return window.$gz.store.state.locale.currencyName;
|
||||
},
|
||||
//////////////////////////////////////////////////
|
||||
// Get the user's chosen 12hr clock
|
||||
//
|
||||
getHour12() {
|
||||
return window.$gz.store.state.locale.hour12;
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short date and time
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
|
||||
//
|
||||
utcDateToShortDateAndTimeLocalized(
|
||||
value,
|
||||
timeZoneName,
|
||||
languageName,
|
||||
hour12
|
||||
) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
if (!hour12) {
|
||||
hour12 = this.getHour12();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
dateStyle: "short",
|
||||
timeStyle: "short",
|
||||
hour12: hour12
|
||||
});
|
||||
}, ///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short date
|
||||
//
|
||||
utcDateToShortDateLocalized(value, timeZoneName, languageName) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleDateString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
dateStyle: "short"
|
||||
});
|
||||
}, ///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short time
|
||||
//
|
||||
utcDateToShortTimeLocalized(value, timeZoneName, languageName, hour12) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
if (!hour12) {
|
||||
hour12 = this.getHour12();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleTimeString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
timeStyle: "short",
|
||||
hour12: hour12
|
||||
});
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a utc date to local time zone
|
||||
// and return time portion only in iso 8601
|
||||
// format (used by time and date picker components)
|
||||
//
|
||||
utcDateStringToLocal8601TimeOnlyString(value, timeZoneName) {
|
||||
if (!value) {
|
||||
//if no value, return the current time as expected by the time picker
|
||||
} else {
|
||||
//ok, the reason for sv-SE is that it's a locale that returns the time already in ISO format and 24hr by default
|
||||
//that can change over time so if this breaks that's why
|
||||
//also fr-CA does as well as possibly en-CA
|
||||
//https://stackoverflow.com/a/58633686/8939
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
return new Date(value).toLocaleTimeString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
});
|
||||
}
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a local time only string with date string
|
||||
// to UTC and output as ISO 8601
|
||||
// (used by time and date picker components)
|
||||
//
|
||||
localTimeDateStringToUTC8601String(value, timeZoneName) {
|
||||
//https://moment.github.io/luxon/docs/manual/zones.html#creating-datetimes-in-a-zone
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
//parse in the time in the currently used timezone
|
||||
return window.$gz.DateTime.fromISO(value, {
|
||||
zone: this.timeZoneName
|
||||
})
|
||||
.setZone("utc") //convert to UTC
|
||||
.toISO(); //output as ISO 8601
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a utc date to local time zone
|
||||
// and return date only portion only in iso 8601
|
||||
// format (used by time and date picker components)
|
||||
//
|
||||
utcDateStringToLocal8601DateOnlyString(value, timeZoneName) {
|
||||
if (!value) {
|
||||
//if no value, return the current time as expected by the time picker
|
||||
} else {
|
||||
//ok, the reason for sv-SE is that it's a locale that returns the time already in ISO format and 24hr by default
|
||||
//that can change over time so if this breaks that's why
|
||||
//also fr-CA does as well as possibly en-CA
|
||||
//https://stackoverflow.com/a/58633686/8939
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
return new Date(value).toLocaleDateString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
});
|
||||
}
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a decimal number into a local
|
||||
// currency display
|
||||
//
|
||||
currencyLocalized(value, languageName, currencyName) {
|
||||
if (!value) return "";
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
if (!currencyName) {
|
||||
currencyName = this.getCurrencyName();
|
||||
}
|
||||
|
||||
return new Intl.NumberFormat(languageName, {
|
||||
style: "currency",
|
||||
currency: currencyName
|
||||
}).format(value);
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a decimal number into a local
|
||||
// decimal format display
|
||||
//
|
||||
decimalLocalized(value, languageName) {
|
||||
if (!value) return "";
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
return new Intl.NumberFormat(languageName, {
|
||||
minimumFractionDigits: 2
|
||||
}).format(value);
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ZZeslint-disable */
|
||||
|
||||
//AyaNova Translation related utilities
|
||||
export default {
|
||||
get(key) {
|
||||
// debugger;
|
||||
@@ -178,233 +178,7 @@ export default {
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
////////////////////////////////////////////////////////
|
||||
// attempt to determine user's preferred language settings
|
||||
// As of Jan 2020 all major browsers support
|
||||
// navigator.languages
|
||||
// but some use navigator.language (singular) to denote UI language preference
|
||||
// not browsing language preference
|
||||
// so the ideal way to do this is to use navigator.languages[0] for the preferred language
|
||||
// and ignore the singular property since we don't care about the actual browser UI language
|
||||
// only how the user expects to see the page itself
|
||||
//
|
||||
// also for sake of future proofing and edge cases need to have it be manually settable as well
|
||||
// ############### TODO: modify all of these to put the user's manual override first in line (if there is one)
|
||||
//https://appmakers.dev/bcp-47-language-codes-list/
|
||||
getBrowserLanguages() {
|
||||
return window.navigator.languages;
|
||||
},
|
||||
getBrowserFirstLanguage() {
|
||||
return window.navigator.languages[0];
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Get users default time zone
|
||||
//https://www.iana.org/time-zones
|
||||
//https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
getBrowserTimeZoneName() {
|
||||
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
},
|
||||
//////////////////////////////////////////////////
|
||||
// Get the user's chosen currency name
|
||||
//https://en.wikipedia.org/wiki/ISO_4217
|
||||
getCurrencyName() {
|
||||
return window.$gz.store.state.locale.currencyName;
|
||||
},
|
||||
//////////////////////////////////////////////////
|
||||
// Get the user's chosen 12hr clock
|
||||
//
|
||||
getHour12() {
|
||||
return window.$gz.store.state.locale.hour12;
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short date and time
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
|
||||
//
|
||||
utcDateToShortDateAndTimeLocalized(
|
||||
value,
|
||||
timeZoneName,
|
||||
languageName,
|
||||
hour12
|
||||
) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
if (!hour12) {
|
||||
hour12 = this.getHour12();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
dateStyle: "short",
|
||||
timeStyle: "short",
|
||||
hour12: hour12
|
||||
});
|
||||
}, ///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short date
|
||||
//
|
||||
utcDateToShortDateLocalized(value, timeZoneName, languageName) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleDateString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
dateStyle: "short"
|
||||
});
|
||||
}, ///////////////////////////////////////////
|
||||
// Turn a utc date into a displayable
|
||||
// short time
|
||||
//
|
||||
utcDateToShortTimeLocalized(value, timeZoneName, languageName, hour12) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
|
||||
if (!hour12) {
|
||||
hour12 = this.getHour12();
|
||||
}
|
||||
|
||||
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
|
||||
var parsedDate = new Date(value);
|
||||
|
||||
//is it a valid date?
|
||||
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleTimeString(languageName, {
|
||||
timeZone: timeZoneName,
|
||||
timeStyle: "short",
|
||||
hour12: hour12
|
||||
});
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a utc date to local time zone
|
||||
// and return time portion only in iso 8601
|
||||
// format (used by time and date picker components)
|
||||
//
|
||||
utcDateStringToLocal8601TimeOnlyString(value, timeZoneName) {
|
||||
if (!value) {
|
||||
//if no value, return the current time as expected by the time picker
|
||||
} else {
|
||||
//ok, the reason for sv-SE is that it's a locale that returns the time already in ISO format and 24hr by default
|
||||
//that can change over time so if this breaks that's why
|
||||
//also fr-CA does as well as possibly en-CA
|
||||
//https://stackoverflow.com/a/58633686/8939
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
return new Date(value).toLocaleTimeString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
});
|
||||
}
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a local time only string with date string
|
||||
// to UTC and output as ISO 8601
|
||||
// (used by time and date picker components)
|
||||
//
|
||||
localTimeDateStringToUTC8601String(value, timeZoneName) {
|
||||
//https://moment.github.io/luxon/docs/manual/zones.html#creating-datetimes-in-a-zone
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
//parse in the time in the currently used timezone
|
||||
return window.$gz.DateTime.fromISO(value, {
|
||||
zone: this.timeZoneName
|
||||
})
|
||||
.setZone("utc") //convert to UTC
|
||||
.toISO(); //output as ISO 8601
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a utc date to local time zone
|
||||
// and return date only portion only in iso 8601
|
||||
// format (used by time and date picker components)
|
||||
//
|
||||
utcDateStringToLocal8601DateOnlyString(value, timeZoneName) {
|
||||
if (!value) {
|
||||
//if no value, return the current time as expected by the time picker
|
||||
} else {
|
||||
//ok, the reason for sv-SE is that it's a locale that returns the time already in ISO format and 24hr by default
|
||||
//that can change over time so if this breaks that's why
|
||||
//also fr-CA does as well as possibly en-CA
|
||||
//https://stackoverflow.com/a/58633686/8939
|
||||
if (!timeZoneName) {
|
||||
timeZoneName = this.getBrowserTimeZoneName();
|
||||
}
|
||||
return new Date(value).toLocaleDateString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
});
|
||||
}
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a decimal number into a local
|
||||
// currency display
|
||||
//
|
||||
currencyLocalized(value, languageName, currencyName) {
|
||||
if (!value) return "";
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
if (!currencyName) {
|
||||
currencyName = this.getCurrencyName();
|
||||
}
|
||||
|
||||
return new Intl.NumberFormat(languageName, {
|
||||
style: "currency",
|
||||
currency: currencyName
|
||||
}).format(value);
|
||||
},
|
||||
///////////////////////////////////////////
|
||||
// Turn a decimal number into a local
|
||||
// decimal format display
|
||||
//
|
||||
decimalLocalized(value, languageName) {
|
||||
if (!value) return "";
|
||||
if (!languageName) {
|
||||
languageName = this.getBrowserLanguages();
|
||||
}
|
||||
return new Intl.NumberFormat(languageName, {
|
||||
minimumFractionDigits: 2
|
||||
}).format(value);
|
||||
},
|
||||
////////////////////////////////////////////////////////
|
||||
// dynamically set the vuetify language elements from
|
||||
// users translated text
|
||||
@@ -412,6 +186,5 @@ export default {
|
||||
//
|
||||
setVuetifyDefaultLanguageElements(vm) {
|
||||
vm.$vuetify.lang.locales.en.close = this.get("OK");
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,8 +27,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
formattedValue: this.value,
|
||||
currencyName: window.$gz.translation.getCurrencyName(),
|
||||
languageName: window.$gz.translation.getBrowserFirstLanguage()
|
||||
currencyName: window.$gz.locale.getCurrencyName(),
|
||||
languageName: window.$gz.locale.getBrowserFirstLanguage()
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -45,11 +45,9 @@ export default {
|
||||
oldDate: null,
|
||||
dlgdate: false,
|
||||
//cache display format stuff
|
||||
timeZoneName: window.$gz.translation.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.translation.getBrowserLanguages(),
|
||||
defaultLocale: window.$gz.translation
|
||||
.getBrowserFirstLanguage()
|
||||
.split("-", 1)[0]
|
||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.locale.getBrowserLanguages(),
|
||||
defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0]
|
||||
}),
|
||||
props: {
|
||||
label: String,
|
||||
@@ -86,7 +84,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
formatDateTime() {
|
||||
return window.$gz.translation.utcDateToShortDateAndTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -94,14 +92,14 @@ export default {
|
||||
);
|
||||
},
|
||||
formatDate() {
|
||||
return window.$gz.translation.utcDateToShortDateLocalized(
|
||||
return window.$gz.locale.utcDateToShortDateLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName
|
||||
);
|
||||
},
|
||||
formatTime() {
|
||||
return window.$gz.translation.utcDateToShortTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -111,7 +109,7 @@ export default {
|
||||
dateOnly: {
|
||||
get() {
|
||||
//return date only portion converted to local working time zone: YYYY-MM-DD
|
||||
return window.$gz.translation.utcDateStringToLocal8601DateOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -122,7 +120,7 @@ export default {
|
||||
if (!TimePortion) {
|
||||
TimePortion = "00:00:00";
|
||||
}
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
value + "T" + TimePortion,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -132,7 +130,7 @@ export default {
|
||||
//expects just the hours minutes seconds portion: 18:18:49
|
||||
//Needs to convert into and out of the desired time zone or the control will show the UTC time instead
|
||||
get() {
|
||||
return window.$gz.translation.utcDateStringToLocal8601TimeOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -154,7 +152,7 @@ export default {
|
||||
DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
}
|
||||
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
DatePortion + "T" + value,
|
||||
this.timeZoneName
|
||||
);
|
||||
|
||||
@@ -85,14 +85,10 @@ export default {
|
||||
dlgdate: false,
|
||||
dlgtime: false,
|
||||
//cache display format stuff
|
||||
timeZoneName: window.$gz.translation.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.translation.getBrowserLanguages(),
|
||||
hour12: window.$gz.translation.getHour12(),
|
||||
defaultLocale: window.$gz.translation
|
||||
.getBrowserFirstLanguage()
|
||||
.split("-", 1)[0]
|
||||
// ampmFormat: window.$gz.translation.getHour12() ? "ampm" : "24hr"
|
||||
//:format="ampmFormat"
|
||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.locale.getBrowserLanguages(),
|
||||
hour12: window.$gz.locale.getHour12(),
|
||||
defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0]
|
||||
}),
|
||||
props: {
|
||||
label: String,
|
||||
@@ -129,7 +125,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
formatDateTime() {
|
||||
return window.$gz.translation.utcDateToShortDateAndTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -137,14 +133,14 @@ export default {
|
||||
);
|
||||
},
|
||||
formatDate() {
|
||||
return window.$gz.translation.utcDateToShortDateLocalized(
|
||||
return window.$gz.locale.utcDateToShortDateLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName
|
||||
);
|
||||
},
|
||||
formatTime() {
|
||||
return window.$gz.translation.utcDateToShortTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -154,7 +150,7 @@ export default {
|
||||
dateOnly: {
|
||||
get() {
|
||||
//return date only portion converted to local working time zone: YYYY-MM-DD
|
||||
return window.$gz.translation.utcDateStringToLocal8601DateOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -165,7 +161,7 @@ export default {
|
||||
if (!TimePortion) {
|
||||
TimePortion = "00:00:00";
|
||||
}
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
value + "T" + TimePortion,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -175,7 +171,7 @@ export default {
|
||||
//expects just the hours minutes seconds portion: 18:18:49
|
||||
//Needs to convert into and out of the desired time zone or the control will show the UTC time instead
|
||||
get() {
|
||||
return window.$gz.translation.utcDateStringToLocal8601TimeOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -197,7 +193,7 @@ export default {
|
||||
DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
}
|
||||
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
DatePortion + "T" + value,
|
||||
this.timeZoneName
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
formattedValue: this.value,
|
||||
languageName: window.$gz.translation.getBrowserFirstLanguage()
|
||||
languageName: window.$gz.locale.getBrowserFirstLanguage()
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -602,8 +602,8 @@ function buildRecords(listData, columndefinitions) {
|
||||
}
|
||||
|
||||
//cache display format stuff
|
||||
var timeZoneName = window.$gz.translation.getBrowserTimeZoneName();
|
||||
var languageName = window.$gz.translation.getBrowserLanguages();
|
||||
var timeZoneName = window.$gz.locale.getBrowserTimeZoneName();
|
||||
var languageName = window.$gz.locale.getBrowserLanguages();
|
||||
var hour12 = window.$gz.store.state.locale.hour12;
|
||||
var currencyName = window.$gz.store.state.locale.currencyName;
|
||||
|
||||
@@ -640,7 +640,7 @@ function buildRecords(listData, columndefinitions) {
|
||||
*/
|
||||
switch (dataType) {
|
||||
case 1: //datetime format to shortdatetime
|
||||
display = window.$gz.translation.utcDateToShortDateAndTimeLocalized(
|
||||
display = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
display,
|
||||
timeZoneName,
|
||||
languageName,
|
||||
@@ -648,14 +648,14 @@ function buildRecords(listData, columndefinitions) {
|
||||
);
|
||||
break;
|
||||
case 2: //date only
|
||||
display = window.$gz.translation.utcDateToShortDateLocalized(
|
||||
display = window.$gz.locale.utcDateToShortDateLocalized(
|
||||
display,
|
||||
timeZoneName,
|
||||
languageName
|
||||
);
|
||||
break;
|
||||
case 3: //time only
|
||||
display = window.$gz.translation.utcDateToShortTimeLocalized(
|
||||
display = window.$gz.locale.utcDateToShortTimeLocalized(
|
||||
display,
|
||||
timeZoneName,
|
||||
languageName,
|
||||
@@ -663,13 +663,10 @@ function buildRecords(listData, columndefinitions) {
|
||||
);
|
||||
break;
|
||||
case 7: //decimal
|
||||
display = window.$gz.translation.decimalLocalized(
|
||||
display,
|
||||
languageName
|
||||
);
|
||||
display = window.$gz.locale.decimalLocalized(display, languageName);
|
||||
break;
|
||||
case 8: //currency
|
||||
display = window.$gz.translation.currencyLocalized(
|
||||
display = window.$gz.locale.currencyLocalized(
|
||||
display,
|
||||
languageName,
|
||||
currencyName
|
||||
|
||||
@@ -49,12 +49,10 @@ export default {
|
||||
oldDate: null,
|
||||
dlgtime: false,
|
||||
//cache display format stuff
|
||||
timeZoneName: window.$gz.translation.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.translation.getBrowserLanguages(),
|
||||
hour12: window.$gz.translation.getHour12(),
|
||||
defaultLocale: window.$gz.translation
|
||||
.getBrowserFirstLanguage()
|
||||
.split("-", 1)[0]
|
||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.locale.getBrowserLanguages(),
|
||||
hour12: window.$gz.locale.getHour12(),
|
||||
defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0]
|
||||
}),
|
||||
props: {
|
||||
label: String,
|
||||
@@ -91,7 +89,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
formatDateTime() {
|
||||
return window.$gz.translation.utcDateToShortDateAndTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -99,7 +97,7 @@ export default {
|
||||
);
|
||||
},
|
||||
formatTime() {
|
||||
return window.$gz.translation.utcDateToShortTimeLocalized(
|
||||
return window.$gz.locale.utcDateToShortTimeLocalized(
|
||||
this.value,
|
||||
this.timeZoneName,
|
||||
this.languageName,
|
||||
@@ -109,7 +107,7 @@ export default {
|
||||
dateOnly: {
|
||||
get() {
|
||||
//return date only portion converted to local working time zone: YYYY-MM-DD
|
||||
return window.$gz.translation.utcDateStringToLocal8601DateOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -120,7 +118,7 @@ export default {
|
||||
if (!TimePortion) {
|
||||
TimePortion = "00:00:00";
|
||||
}
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
value + "T" + TimePortion,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -130,7 +128,7 @@ export default {
|
||||
//expects just the hours minutes seconds portion: 18:18:49
|
||||
//Needs to convert into and out of the desired time zone or the control will show the UTC time instead
|
||||
get() {
|
||||
return window.$gz.translation.utcDateStringToLocal8601TimeOnlyString(
|
||||
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
|
||||
this.value,
|
||||
this.timeZoneName
|
||||
);
|
||||
@@ -152,7 +150,7 @@ export default {
|
||||
DatePortion = fullYear + "-" + fullMonth + "-" + fullDay;
|
||||
}
|
||||
|
||||
this.date = window.$gz.translation.localTimeDateStringToUTC8601String(
|
||||
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
|
||||
DatePortion + "T" + value,
|
||||
this.timeZoneName
|
||||
);
|
||||
|
||||
@@ -21,6 +21,7 @@ import gzmenu from "./api/gzmenu";
|
||||
import gzdialog from "./api/gzdialog";
|
||||
import gzutil from "./api/gzutil";
|
||||
import translation from "./api/translation";
|
||||
import locale from "./api/locale";
|
||||
import gzapi from "./api/gzapi";
|
||||
import gzreport from "./api/gzreport";
|
||||
import gzform from "./api/gzform";
|
||||
@@ -52,6 +53,7 @@ import errorhandler from "./api/errorhandler";
|
||||
|
||||
window.$gz = {
|
||||
translation: translation,
|
||||
locale: locale,
|
||||
formCustomTemplate: gzformcustomtemplate,
|
||||
type: gztype,
|
||||
role: authorizationroles,
|
||||
|
||||
@@ -27,27 +27,25 @@
|
||||
<div>
|
||||
<span class="ml-6 body-1">12h: </span>
|
||||
<span class="body-2">
|
||||
{{ translation().getHour12() }}
|
||||
{{ locale().getHour12() }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="ml-6 body-1">{{ lt("TimeZone") }}: </span>
|
||||
<span class="body-2">
|
||||
{{ translation().getBrowserTimeZoneName() }}
|
||||
{{ locale().getBrowserTimeZoneName() }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="ml-6 body-1">{{ lt("LanguageCode") }}: </span>
|
||||
<span class="body-2">{{
|
||||
translation().getBrowserFirstLanguage()
|
||||
}}</span>
|
||||
<span class="body-2">{{ locale().getBrowserFirstLanguage() }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="ml-6 body-1">{{ lt("CurrencyCode") }}: </span>
|
||||
<span class="body-2">{{ translation().getCurrencyName() }}</span>
|
||||
<span class="body-2">{{ locale().getCurrencyName() }}</span>
|
||||
</div>
|
||||
|
||||
<v-divider class="mt-6"></v-divider>
|
||||
@@ -173,6 +171,9 @@ export default {
|
||||
},
|
||||
translation() {
|
||||
return window.$gz.translation;
|
||||
},
|
||||
locale() {
|
||||
return window.$gz.locale;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1462,15 +1462,15 @@ function getDisplayForFilter(
|
||||
var valueDisplay = "selected value";
|
||||
switch (uiFieldDataType) {
|
||||
case 1: //date translate
|
||||
valueDisplay = window.$gz.translation.utcDateToShortDateAndTimeLocalized(
|
||||
valueDisplay = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
||||
filterValue
|
||||
);
|
||||
break;
|
||||
case 8: //currency translate
|
||||
valueDisplay = window.$gz.translation.currencyLocalized(filterValue);
|
||||
valueDisplay = window.$gz.locale.currencyLocalized(filterValue);
|
||||
break;
|
||||
case 7: //decimal translate
|
||||
valueDisplay = window.$gz.translation.decimalLocalized(filterValue);
|
||||
valueDisplay = window.$gz.locale.decimalLocalized(filterValue);
|
||||
break;
|
||||
case 6: //BOOL translate
|
||||
//debugger;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.languageOverride"
|
||||
:placeholder="translation().getBrowserFirstLanguage()"
|
||||
:placeholder="locale().getBrowserFirstLanguage()"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('languageOverride')"
|
||||
@@ -87,7 +87,7 @@
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.timeZoneOverride"
|
||||
:placeholder="translation().getBrowserTimeZoneName()"
|
||||
:placeholder="locale().getBrowserTimeZoneName()"
|
||||
:readonly="formState.readOnly"
|
||||
clearable
|
||||
@click:clear="onChange('timeZoneOverride')"
|
||||
|
||||
Reference in New Issue
Block a user