Localization of numbers and dates is not working in Nuxt3 + VueI18n
14:22 28 Mar 2024

I've tried to configure Nuxt 3 along with the VueI18n plugin as described here. It works fine for "normal" translations using $t() within the template or using t() in the script part. I load my files containing the translations lazy from a S3 bucket, each language its own file. Also the localization of URLs is working.

Only the localization of numbers ($n()) and dates ($d()) is not working. I followed this guide without success.

Here is my Vue component:




$n() gives me a warning on the console: [intlify] Not found 'currency' key in 'de_DE' locale messages.

$d() gives me a 500 error with this message: Incorrect locale information provided. Providing a locale as second parameter $d("2023-05-06", "de_DE") gives me this error message: [intlify] Not found 'de_DE' key in 'de_DE' locale messages.)`

Please see my Nuxt configuration file below:

export default defineNuxtConfig({
    pages: true
    app: {},
    modules: [
        'nuxt-gtag',
        '@nuxtjs/i18n'
    ],
    i18n: {
        defaultLocale: 'de_DE',
        lazy: true,
        langDir: 'lang',
        locales: [{ code: 'de_DE', file: 'loadFromS3.ts', iso: 'de-DE', isCatchallLocale: true }],
        strategy: 'prefix_except_default',
        customRoutes: 'config',
        pages: {
            'catalog/index': {
                de_DE: '/katalog'
            },
            'index': {
                de_DE: '/'
            }
        }
    }
})
vue.js nuxt.js vue-i18n