feat(i18n): refactor i18n module configuration (#292)

This commit is contained in:
Joaquín Sánchez 2022-12-02 13:54:09 +01:00 committed by GitHub
parent 8fc6148a3b
commit d17994338d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 98 deletions

View file

@ -1,5 +1,7 @@
import Inspect from 'vite-plugin-inspect'
import { isCI, isDevelopment } from 'std-env'
import { i18n } from './modules/i18n-configuration'
export default defineNuxtConfig({
ssr: false,
modules: [
@ -81,101 +83,7 @@ export default defineNuxtConfig({
viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
},
},
i18n: {
locales: [
{
code: 'en-US',
file: 'en-US.json',
name: 'English',
},
{
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',
},
].sort((a, b) => a.code.localeCompare(b.code)),
strategy: 'no_prefix',
detectBrowserLanguage: false,
langDir: 'locales',
defaultLocale: 'en-US',
vueI18n: {
fallbackLocale: 'en-US',
datetimeFormats: {
'en-US': {
long: {
dateStyle: 'long',
timeStyle: 'medium',
/*
year: 'numeric',
month: 'short',
day: 'numeric',
weekday: 'short',
hour: 'numeric',
minute: 'numeric',
*/
},
},
'es-ES': {
long: {
dateStyle: 'long',
timeStyle: 'medium',
/*
year: 'numeric',
month: 'short',
day: 'numeric',
weekday: 'short',
hour: 'numeric',
minute: 'numeric',
hour12: false,
*/
},
},
'ja-JP': {
long: {
dateStyle: 'long',
timeStyle: 'medium',
/*
year: 'numeric',
month: 'short',
day: 'numeric',
weekday: 'short',
hour: 'numeric',
minute: 'numeric',
hour12: true,
*/
},
},
'zh-CN': {
long: {
dateStyle: 'long',
timeStyle: 'medium',
},
},
'de-DE': {
long: {
dateStyle: 'long',
timeStyle: 'medium',
},
},
},
},
lazy: true,
},
i18n,
})
declare global {