diff --git a/src/i18n/index.ts b/src/i18n/index.ts index e186adc..6c44120 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,4 +1,4 @@ -import { createI18n } from 'vue-i18n'; +import { createI18n, IntlNumberFormat } from 'vue-i18n'; import de from './locales/de.json'; import en from './locales/en.json'; import br from './locales/pt-br.json'; @@ -14,11 +14,22 @@ export const initialLocale = availableLocales.includes(browserLocale) ? browserL export type AvailableLocale = keyof typeof messages; +const numberFormats: IntlNumberFormat = { + currency: { + minimumFractionDigits: 0, + style: 'currency' + }, + percent: { + maximumFractionDigits: 0, + style: 'percent' + } +}; + /* eslint-disable @typescript-eslint/no-explicit-any */ export const i18n = createI18n({ legacy: false, fallbackLocale: 'en', locale: initialLocale, messages: messages as any, - numberFormats: Object.fromEntries(Object.entries(messages).map((v) => [[v[0]], v[1]._numberFormats])) + numberFormats: Object.fromEntries(availableLocales.map((locale) => [locale, numberFormats])) }); diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index b6e32f5..3de74f2 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -1,15 +1,4 @@ { - "_numberFormats": { - "currency": { - "currency": "USD", - "minimumFractionDigits": 0, - "style": "currency" - }, - "percent": { - "maximumFractionDigits": 0, - "style": "percent" - } - }, "navigation": { "tools": { "tools": "Werkzeuge", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index e0e8344..f8e9b9b 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1,15 +1,4 @@ { - "_numberFormats": { - "currency": { - "currency": "USD", - "minimumFractionDigits": 0, - "style": "currency" - }, - "percent": { - "maximumFractionDigits": 0, - "style": "percent" - } - }, "navigation": { "tools": { "tools": "Tools", diff --git a/src/i18n/locales/pt-br.json b/src/i18n/locales/pt-br.json index de33ded..9e54d07 100644 --- a/src/i18n/locales/pt-br.json +++ b/src/i18n/locales/pt-br.json @@ -1,15 +1,4 @@ { - "_numberFormats": { - "currency": { - "currency": "USD", - "minimumFractionDigits": 0, - "style": "currency" - }, - "percent": { - "maximumFractionDigits": 0, - "style": "percent" - } - }, "navigation": { "tools": { "tools": "Ferramentas", diff --git a/src/i18n/locales/tr.json b/src/i18n/locales/tr.json index 8340ac1..82bf050 100644 --- a/src/i18n/locales/tr.json +++ b/src/i18n/locales/tr.json @@ -1,15 +1,4 @@ { - "_numberFormats" : { - "currency" : { - "currency" : "USD", - "minimumFractionDigits" : 0, - "style": "currency" - }, - "percent": { - "maximumFractionDigits": 0, - "style": "percent" - } - }, "navigation" : { "admin" : { "admin" : "Yƶnetici",