Nuxt i18n
API

Runtime config

Module options that can be overridden at runtime using runtime config and environment variables.

Some options can be set via the runtimeConfig, setting options this way makes it possible to override these after building using environment variables.

Usage

If you want to use environment variables to change supported options, you will have to set these in runtimeConfig.public.i18n.

nuxt.config.ts
export default defineNuxtConfig({
    modules: ['@nuxtjs/i18n'],
    i18n: {
        // Leave options unset that you want to set using `runtimeConfig`
        // baseUrl: 'https://example.com',
    },
    runtimeConfig: {
        public: {
            i18n: {
                baseUrl: 'https://example.com',
                domainLocales: {}
                // other options ...
            }
        }
    }
})

You can read more about how this works in the Nuxt documentation.

Only serializable values are supported in runtimeConfig, options set this way may not support all available types (such as functions) as would normally be possible using the default configuration.
If you would like other options to be supported, open an issue describing your use case, or open a PR to add support yourself!

Supported options

The module configuration is used as the default value of these options, values set through runtimeConfig or environment variables take precedence.

These options can be set using runtimeConfig:

baseUrl

  • key: NUXT_PUBLIC_I18N_BASE_URL

This runtime config option is the same as the baseUrl module option.

Note that the baseUrl module option allows you to set the function, but the runtime config does not due to limitations.

domainLocales

  • property: domainLocales[code].domain
  • key: NUXT_PUBLIC_I18N_DOMAIN_LOCALES_{code}_DOMAIN

This runtime config option allows overriding the domain set in the locales module option.

detectBrowserLanguage

  • property: detectBrowserLanguage, detectBrowserLanguage[option]
  • key: NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE, NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE_{option}

This runtime config option is the same as the detectBrowserLanguage module option, each of its properties can be overridden separately.

For example:

production.env
NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE_COOKIE_DOMAIN=example.com
NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE_COOKIE_KEY=my_locale

Detection can be disabled by setting the option itself to false:

production.env
NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE=false
Environment variables can only override properties while detection is enabled, they have no effect when detectBrowserLanguage is false.

To enable detection when it is disabled in the module configuration, set the option itself to a JSON value. This value is not merged with the default values of the option, so set each property you need.

production.env
NUXT_PUBLIC_I18N_DETECT_BROWSER_LANGUAGE='{"useCookie":true,"redirectOn":"root"}'
Copyright © 2026