Skip to content

Commit 35c3601

Browse files
authored
chore!: drop bundle.optimizeTranslationDirective (#3515)
1 parent debbe13 commit 35c3601

6 files changed

Lines changed: 8 additions & 26 deletions

File tree

docs/content/docs/02.guide/90.migrating.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ title: Migration Guide
33
description: Follow this guide to upgrade from one major version to the other.
44
---
55

6+
## Upgrading from `nuxtjs/i18n` v9.x to v10.x
7+
8+
### Drop `bundle.optimizeTranslationDirective`
9+
This feature has been disabled and the option to enable it has been removed, see [the discussion in this issue](https://github.com/nuxt-modules/i18n/issues/3238#issuecomment-2672492536) for context on this change.
10+
611
## Upgrading from `nuxtjs/i18n` v8.x to v9.x
712

813
### Upgrade to Vue I18n v10

docs/content/docs/04.api/00.options.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,6 @@ It can be useful if you have one code base (e.g. [Nuxt Layers](https://nuxt.com/
438438
The value of this **option will not be merged with other Nuxt Layers**. This option should only be specified in the final project config.
439439
::
440440

441-
### `optimizeTranslationDirective`
442-
443-
- type: `boolean`{lang="ts-type"}
444-
- default: `true`{lang="ts"}
445-
446-
Whether to optimize `v-t` directive by transforming it's usage into a vue-i18n translation function, this needs to be enabled for projects using the `v-t` directive with SSR.
447-
448441
## experimental
449442

450443
Experimental configuration property is an object with the following properties:

src/bundler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function createLogger(label) {
6767
defaultSFCLang: options.customBlocks.defaultSFCLang,
6868
globalSFCScope: options.customBlocks.globalSFCScope,
6969
dropMessageCompiler: options.bundle.dropMessageCompiler,
70-
optimizeTranslationDirective: options.bundle.optimizeTranslationDirective
70+
optimizeTranslationDirective: false
7171
}
7272
addBuildPlugin({
7373
vite: () => VueI18nPlugin.vite(vueI18nPluginOptions),

src/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ export const DEFAULT_OPTIONS = {
3939
compositionOnly: true,
4040
runtimeOnly: false,
4141
fullInstall: true,
42-
dropMessageCompiler: false,
43-
optimizeTranslationDirective: true
42+
dropMessageCompiler: false
4443
},
4544
compilation: {
4645
strictMessage: true,

src/prepare/options.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ export function prepareOptions({ debug, logger, options }: I18nNuxtContext, nuxt
2020
)
2121
}
2222

23-
if (
24-
!nuxt.options?._prepare &&
25-
!nuxt.options?.test &&
26-
nuxt.options.i18n?.bundle?.optimizeTranslationDirective == null
27-
) {
28-
logger.warn(
29-
'`bundle.optimizeTranslationDirective` is enabled by default, we recommend disabling this feature as it causes issues and will be deprecated in v10.\nExplicitly setting this option to `true` or `false` disables this warning, for more details see: https://github.com/nuxt-modules/i18n/issues/3238#issuecomment-2672492536'
30-
)
31-
}
32-
3323
if (options.experimental.autoImportTranslationFunctions && nuxt.options.imports.autoImport === false) {
3424
logger.warn(
3525
'Disabling `autoImports` in Nuxt is not compatible with `experimental.autoImportTranslationFunctions`, either enable `autoImports` or disable `experimental.autoImportTranslationFunctions`.'

src/types.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,7 @@ export interface ExperimentalFeatures {
122122
export interface BundleOptions
123123
extends Pick<
124124
PluginOptions,
125-
| 'compositionOnly'
126-
| 'runtimeOnly'
127-
| 'fullInstall'
128-
| 'dropMessageCompiler'
129-
| 'onlyLocales'
130-
| 'optimizeTranslationDirective'
125+
'compositionOnly' | 'runtimeOnly' | 'fullInstall' | 'dropMessageCompiler' | 'onlyLocales'
131126
> {}
132127

133128
export interface CustomBlocksOptions extends Pick<PluginOptions, 'defaultSFCLang' | 'globalSFCScope'> {}

0 commit comments

Comments
 (0)