🐛 Use default user country
This commit is contained in:
parent
51e465ce43
commit
50c4f93a2c
|
@ -33,14 +33,14 @@
|
|||
import { GA_COOKIE_NAME } from '@/config/analytics'
|
||||
import { SUPPORTED_LOCALES } from '@/config'
|
||||
import { setCookie, getCookie } from '@/helper/cookies'
|
||||
import { getCountryByIP, getTranslatedUrl } from '@/i18n/helper'
|
||||
import { getCountryByIP, getUserLanguage, getTranslatedUrl } from '@/i18n/helper'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
|
||||
data () {
|
||||
return {
|
||||
userCountry: null,
|
||||
userCountry: getUserLanguage().country,
|
||||
showConsentLayer: getCookie(GA_COOKIE_NAME) === null,
|
||||
euromatLogo: require('@/assets/svg/euromat-logo.svg'),
|
||||
logoSize: 220,
|
||||
|
|
|
@ -24,11 +24,14 @@ export function getUserLanguage () {
|
|||
window.navigator.userLanguage ||
|
||||
DEFAULT_LOCALE
|
||||
)
|
||||
return lang.split('-')[0]
|
||||
return {
|
||||
language: lang.split('-')[0],
|
||||
country: lang.split('-')[1]
|
||||
}
|
||||
}
|
||||
|
||||
export function getUserSupportedLanguage () {
|
||||
const language = getUserLanguage()
|
||||
const { language } = getUserLanguage()
|
||||
return isLangSupported(language)
|
||||
? language
|
||||
: DEFAULT_LOCALE
|
||||
|
|
|
@ -11,7 +11,7 @@ export function getPageTitle (data = {}) {
|
|||
export function beforeEnter (to, from, next) {
|
||||
const lang = to.params.locale
|
||||
if (!i18n.isLangSupported(lang)) {
|
||||
return next(i18n.getUserLanguage())
|
||||
return next(i18n.getUserLanguage().language)
|
||||
}
|
||||
|
||||
i18n.setCurrentLocale(lang)
|
||||
|
|
Loading…
Reference in a new issue