2022-12-02 15:54:09 +03:00
|
|
|
import type { NuxtI18nOptions } from '@nuxtjs/i18n'
|
|
|
|
import type { DateTimeFormats } from '@intlify/core-base'
|
|
|
|
import type { LocaleObject } from '#i18n'
|
|
|
|
|
2022-12-29 20:52:12 +03:00
|
|
|
const locales = ([
|
2022-12-02 15:54:09 +03:00
|
|
|
{
|
|
|
|
code: 'en-US',
|
|
|
|
file: 'en-US.json',
|
2022-12-28 09:50:26 +03:00
|
|
|
name: 'English (US)',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'en-GB',
|
|
|
|
file: 'en-GB.json',
|
|
|
|
name: 'English (UK)',
|
2022-12-02 15:54:09 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'de-DE',
|
|
|
|
file: 'de-DE.json',
|
|
|
|
name: 'Deutsch',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'zh-CN',
|
|
|
|
file: 'zh-CN.json',
|
|
|
|
name: '简体中文',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'ja-JP',
|
|
|
|
file: 'ja-JP.json',
|
|
|
|
name: '日本語',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'es-ES',
|
|
|
|
file: 'es-ES.json',
|
|
|
|
name: 'Español',
|
|
|
|
},
|
2022-12-02 23:27:58 +03:00
|
|
|
{
|
|
|
|
code: 'fr-FR',
|
|
|
|
file: 'fr-FR.json',
|
|
|
|
name: 'Français',
|
|
|
|
},
|
2022-12-15 00:19:38 +03:00
|
|
|
{
|
|
|
|
code: 'cs-CZ',
|
|
|
|
file: 'cs-CZ.json',
|
|
|
|
name: 'Česky',
|
2022-12-26 18:12:04 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
code: 'ar',
|
|
|
|
file: 'ar-EG.json',
|
|
|
|
name: 'العربية',
|
|
|
|
dir: 'rtl',
|
2022-12-15 00:19:38 +03:00
|
|
|
},
|
2022-12-29 20:52:12 +03:00
|
|
|
] satisfies LocaleObject[]).sort((a, b) => a.code.localeCompare(b.code))
|
2022-12-02 15:54:09 +03:00
|
|
|
|
|
|
|
const datetimeFormats = Object.keys(locales).reduce((acc, key) => {
|
|
|
|
acc[key] = {
|
|
|
|
short: {
|
|
|
|
dateStyle: 'short',
|
|
|
|
timeStyle: 'short',
|
|
|
|
},
|
|
|
|
long: {
|
|
|
|
dateStyle: 'long',
|
|
|
|
timeStyle: 'medium',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
return acc
|
|
|
|
}, <DateTimeFormats>{})
|
|
|
|
|
2022-12-07 00:04:38 +03:00
|
|
|
export const i18n: NuxtI18nOptions = {
|
2022-12-02 15:54:09 +03:00
|
|
|
locales,
|
|
|
|
strategy: 'no_prefix',
|
|
|
|
detectBrowserLanguage: false,
|
|
|
|
langDir: 'locales',
|
|
|
|
defaultLocale: 'en-US',
|
|
|
|
vueI18n: {
|
|
|
|
fallbackLocale: 'en-US',
|
2022-12-02 20:23:47 +03:00
|
|
|
fallbackWarn: false,
|
|
|
|
missingWarn: false,
|
2022-12-02 15:54:09 +03:00
|
|
|
datetimeFormats,
|
|
|
|
},
|
|
|
|
lazy: true,
|
|
|
|
}
|