This commit is contained in:
@@ -48,12 +48,29 @@ CURRENT TODOs
|
|||||||
SHELL / NAV / MENUS / LAYOUT
|
SHELL / NAV / MENUS / LAYOUT
|
||||||
|
|
||||||
TODO: LOCALIZATION
|
TODO: LOCALIZATION
|
||||||
|
- NEED to accept and display numbers and dates and times, nothing else really matters
|
||||||
|
- NUMBER FORMATTING REQUIRED INFO
|
||||||
|
- USEROPTIONS: Currency symbol
|
||||||
|
- USEROPTIONS: digit grouping symbol (thousands separator)
|
||||||
|
- USEROPTIONS: decimal symbol
|
||||||
|
- DATE TIME FORMATTING REQUIRED INFO
|
||||||
|
- LOCALETEXT: Month names in full
|
||||||
|
- Month abbreviations 3 characters maybe can just use first 3 of names above
|
||||||
|
- LOCALETEXT: Day of week
|
||||||
|
- First letter of day of week and first three letters of day of week are used in date input
|
||||||
|
- LOCALETEXT: AM / PM symbols
|
||||||
|
- USEROPTIONS: Short date template
|
||||||
|
- USEROPTIONS: Short time template
|
||||||
|
|
||||||
|
|
||||||
|
- All major browsers support Intl api now:
|
||||||
|
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
|
||||||
- IDENTIFY: what needs to be localized besides display titles?
|
- IDENTIFY: what needs to be localized besides display titles?
|
||||||
- Currency input, display
|
- Currency input, display
|
||||||
- decimal number input, display
|
- decimal number input, display
|
||||||
- Date and times MONTH names in input (and some ancillary text maybe like "year")
|
- Date and times MONTH names in input (and some ancillary text maybe like "year")
|
||||||
- Date and time display
|
- Date and time display
|
||||||
|
|
||||||
- INPUT currency / decimal can a german user input a currency as 1.234,56 ? (comma is the decimal separator and decimal is the thousands separator)
|
- INPUT currency / decimal can a german user input a currency as 1.234,56 ? (comma is the decimal separator and decimal is the thousands separator)
|
||||||
- vuetify currency field: https://gist.github.com/Christilut/1143d453ea070f7e8fa345f7ada1b999
|
- vuetify currency field: https://gist.github.com/Christilut/1143d453ea070f7e8fa345f7ada1b999
|
||||||
- Not vuetify specifically but may have stealable code: https://dm4t2.github.io/vue-currency-input/
|
- Not vuetify specifically but may have stealable code: https://dm4t2.github.io/vue-currency-input/
|
||||||
|
|||||||
@@ -785,7 +785,8 @@ export default function initialize() {
|
|||||||
shortDate: "YYYY-MM-DD",
|
shortDate: "YYYY-MM-DD",
|
||||||
shortTime: "hh:mm:ss A",
|
shortTime: "hh:mm:ss A",
|
||||||
shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
||||||
timeZoneOffset: res.data.timeZoneOffset
|
timeZoneOffset: res.data.timeZoneOffset,
|
||||||
|
tag: res.data.tag || "en-US"
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -190,5 +190,55 @@ export default {
|
|||||||
ret = ret.replace(foundMatch, newValue);
|
ret = ret.replace(foundMatch, newValue);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
},
|
||||||
|
////////////////////////////////////////////////////////
|
||||||
|
// attempt to determine user's preferred first browser language setting
|
||||||
|
// https://stackoverflow.com/a/46514247/8939
|
||||||
|
//
|
||||||
|
//
|
||||||
|
getFirstBrowserLanguage() {
|
||||||
|
var nav = window.navigator,
|
||||||
|
browserLanguagePropertyKeys = [
|
||||||
|
"language",
|
||||||
|
"browserLanguage",
|
||||||
|
"systemLanguage",
|
||||||
|
"userLanguage"
|
||||||
|
],
|
||||||
|
i,
|
||||||
|
language,
|
||||||
|
len,
|
||||||
|
shortLanguage = null;
|
||||||
|
|
||||||
|
// support for HTML 5.1 "navigator.languages"
|
||||||
|
if (Array.isArray(nav.languages)) {
|
||||||
|
for (i = 0; i < nav.languages.length; i++) {
|
||||||
|
language = nav.languages[i];
|
||||||
|
len = language.length;
|
||||||
|
if (!shortLanguage && len) {
|
||||||
|
shortLanguage = language;
|
||||||
|
}
|
||||||
|
if (language && len > 2) {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// support for other well known properties in browsers
|
||||||
|
for (i = 0; i < browserLanguagePropertyKeys.length; i++) {
|
||||||
|
language = nav[browserLanguagePropertyKeys[i]];
|
||||||
|
//skip this loop iteration if property is null/undefined. IE11 fix.
|
||||||
|
if (language == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
len = language.length;
|
||||||
|
if (!shortLanguage && len) {
|
||||||
|
shortLanguage = language;
|
||||||
|
}
|
||||||
|
if (language && len > 2) {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return shortLanguage;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default new Vuex.Store({
|
|||||||
homePage: undefined,
|
homePage: undefined,
|
||||||
localeText: {},
|
localeText: {},
|
||||||
locale: {
|
locale: {
|
||||||
|
tag: "en-US",
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$",
|
currencySymbol: "$",
|
||||||
shortDate: "YYYY-MM-DD",
|
shortDate: "YYYY-MM-DD",
|
||||||
@@ -56,6 +57,7 @@ export default new Vuex.Store({
|
|||||||
state.localeText = {};
|
state.localeText = {};
|
||||||
state.formCustomTemplate = {};
|
state.formCustomTemplate = {};
|
||||||
state.apiUrl = "";
|
state.apiUrl = "";
|
||||||
|
state.locale.tag = "en-US";
|
||||||
state.locale.decimalSeparator = ".";
|
state.locale.decimalSeparator = ".";
|
||||||
state.locale.currencySymbol = "$";
|
state.locale.currencySymbol = "$";
|
||||||
state.locale.shortDate = "YYYY-MM-DD";
|
state.locale.shortDate = "YYYY-MM-DD";
|
||||||
@@ -82,6 +84,7 @@ export default new Vuex.Store({
|
|||||||
state.locale.shortTime = data.shortTime;
|
state.locale.shortTime = data.shortTime;
|
||||||
state.locale.shortDateAndTime = data.shortDateAndTime;
|
state.locale.shortDateAndTime = data.shortDateAndTime;
|
||||||
state.locale.timeZoneOffset = data.timeZoneOffset;
|
state.locale.timeZoneOffset = data.timeZoneOffset;
|
||||||
|
state.locale.tag = data.tag;
|
||||||
},
|
},
|
||||||
setAPIURL(state, data) {
|
setAPIURL(state, data) {
|
||||||
state.apiUrl = data;
|
state.apiUrl = data;
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
<span class="body-2">{{ this.$store.state.userName }}</span>
|
<span class="body-2">{{ this.$store.state.userName }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span class="ml-6 body-1">{{ lt("Language") }}:</span>
|
||||||
|
<span class="body-2">
|
||||||
|
{{ ltFormat().tag }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span class="ml-6 body-1">{{ lt("UserTimeZoneOffset") }}:</span>
|
<span class="ml-6 body-1">{{ lt("UserTimeZoneOffset") }}:</span>
|
||||||
<span class="body-2">
|
<span class="body-2">
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<UnderConstruction />
|
<div>
|
||||||
|
User's preferred language:
|
||||||
|
{{ userLanguage }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import UnderConstruction from "../components/underconstruction.vue";
|
import UnderConstruction from "../components/underconstruction.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
data() {
|
||||||
UnderConstruction
|
return {
|
||||||
|
userLanguage: window.$gz.locale.getFirstBrowserLanguage()
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
components: {},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
window.$gz.eventBus.$emit("menu-change", {
|
window.$gz.eventBus.$emit("menu-change", {
|
||||||
isMain: true,
|
isMain: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user