const I18N_LOCALES = [ { name: 'EN', value: 'en' }, { name: 'IT', value: 'it' }, ] const I18N_STRINGS = { en: { E_VAL_REQUIRED: 'required', E_VAL_NOT_EMPTY: 'required not empty', E_VAL_LENGTH_10: 'length must be less or equal to 10', E_VAL_EMAIL: 'invalid email', E_SOME_FIELD_IS_NULL: 'Some fields have not been set and are mandatory', global: { hello: 'hello world', }, table: { search: 'Search', }, dialogs: { option_title: 'Choice option', option_text: "select one of these values:", prompt: 'Question ?', }, }, it: { E_VAL_REQUIRED: 'richiesto', E_VAL_NOT_EMPTY: 'richiesto valore non vuoto', E_VAL_LENGTH_10: 'lunghezza minore o uguale a 10', E_VAL_EMAIL: 'email non valida', E_SOME_FIELD_IS_NULL: 'Alcuni campi non sono stati impostati e risultano obbligatori', global: { hello: 'Ciao!', }, table: { search: 'Cerca', }, dialogs: { option_title: 'Scelta opzioni', option_text: "Seleziona una possible opzione:", prompt: 'Domanda ?', }, } } function translate(x) { try { return app.$t(x) } catch (ex) { return x } } function getBrowserLang() { let blang = navigator.language if (blang) return blang.split('-')[0] else return null }