Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to add i18n config in nuxt.config.ts #3011

Closed
mir1198yusuf opened this issue Jul 3, 2024 · 2 comments
Closed

Not able to add i18n config in nuxt.config.ts #3011

mir1198yusuf opened this issue Jul 3, 2024 · 2 comments

Comments

@mir1198yusuf
Copy link

Environment



Reproduction

This error does not come on StackBlitz or CodeSandbox

Describe the bug

When I add i18n config to defineNuxtConfig, I get this error while adding below i18n object

nuxt.config.ts

defineNuxtConfig({
...
modules: [..."@nuxtjs/i18n"],
i18n: {
     vueI18n: {
            strategy: 'prefix_except_default',
            defaultLocale: 'en-IN',
            locales: [
                {
                    code: 'us',
                    name: 'English',
                    iso: 'en-US',
                },
                {
                    code: 'en-IN',
                    name: 'English',
                    iso: 'en-IN',
                },
            ],
        }
}
...
})

Error on hovering vueI18n:

Object literal may only specify known properties, and 'vueI18n' does not exist in type 'Partial<ModuleOptions>'.ts(2353)
module.d.ts(470, 9): The expected type comes from property 'i18n' which is declared here on type 'InputConfig<NuxtConfig, ConfigLayerMeta>'

Additional context

No response

Logs

No response

@steffenstolze
Copy link

steffenstolze commented Jul 5, 2024

This is a path to a file.

image

add a i18n.config.ts file next to your nuxt config with your content:

export default {
	... your config
};

and adjust your nuxt config like this if you want to use a custom name for the config file:

i18n: {
     vueI18n: './my-crazy-i18n-config.ts'
....
}

@BobbieGoede
Copy link
Collaborator

@steffenstolze is right, configuring vue-i18n specific options was changed in v8, please refer to https://i18n.nuxtjs.org/docs/guide/migrating#deprecated-vuei18n-option-to-not-accept-createi18n-options for more details.

@BobbieGoede BobbieGoede closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants