You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/02.guide/90.migrating.md
+54-32Lines changed: 54 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,64 +1,86 @@
1
1
---
2
2
title: Migration Guide
3
-
description: Follow this guide to upgrade from one major version to the other.
3
+
description: Follow this guide to upgrade from v9.x to v10.x
4
+
toc:
5
+
depth: 3
4
6
---
5
7
6
-
## Upgrading from `nuxtjs/i18n` v9.x to v10.x
7
-
8
8
### Upgrade to Vue I18n v11
9
9
We have upgrade from Vue I18n v10 to v11, this major version bump deprecates the Legacy API mode and custom `v-t` directive and drops `tc` and `$tc` from Legacy API mode.
10
10
11
11
Check the documentation detailing the breaking changes [here](https://vue-i18n.intlify.dev/guide/migration/breaking11.html).
12
12
13
-
### Lazy load locale messages by default and removed `lazy` option
13
+
### Lazy loading
14
14
The `lazy` option has been removed and lazy loading of locale messages is now the default behavior.
15
15
16
-
### Function signature corrected for `finalizePendingLocaleChange()`{lang="ts"}
The function signature for `finalizePendingLocaleChange()`{lang="ts"} has been corrected from `() => Promise<void>`{lang="ts-type"} to `() => void`{lang="ts-type"}.
18
18
This change was made since the function does not rely on any async operations and should not be awaited, and should prevent unnecessary function coloring.
19
19
20
-
### Option default changed `useLocaleHead()`{lang="ts"} and `$localeHead()`{lang="ts"}
20
+
### Default arguments changed `useLocaleHead()`{lang="ts"} and `$localeHead()`{lang="ts"}
21
21
The default value for the `key` property has been changed from `'hid'` to `'key'`.
22
22
23
-
### Deprecate `$localeHead()`{lang="ts"}
24
-
The `$localeHead()`{lang="ts"} Nuxt context function has been deprecated and will be removed in v11.
23
+
### `restructureDir` migration path removed
24
+
To ease migration in v9 it was possible to disable the new directory structure by setting `restructureDir: false`, this has now been removed and we recommend using the default value of `'i18n'`.
25
+
25
26
26
-
This context function has limited use cases, the `useLocaleHead` composable offers the same functionality and is easier to use in combination with `useHead`.
27
+
### Removed options
28
+
The following options have been removed:
27
29
28
-
###Deprecate `$getRouteBaseName()`{lang="ts"} in favor of `$routeBaseName()`{lang="ts"}
29
-
The `$getRouteBaseName()`{lang="ts"} Nuxt context function has been deprecated and will be removedin v11.
* 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.
30
32
31
-
We are renaming this function to `$routeBaseName()`{lang="ts"} to be consistent with the other context functions and their composable counterparts.
* File paths (e.g. locale files, vue-i18n configs) configured for this module are now removed from the build entirely making this option obsolete.
32
35
33
-
### Promote `experimental.autoImportTranslationFunctions` to `autoDeclare`
34
-
This functionality is stable and is now enabled by default, the option has been moved out of the `experimental` configuration object and renamed to `autoDeclare`.
This functionality is stable and is now enabled by default and the option to enable/disable it has been removed.
37
+
### Deprecated options
38
+
The following options have been deprecated and will be removed in v11:
38
39
39
-
###Promote `experimental.hmr` to `hmr`
40
-
The HMR functionality is stable, it was already enabled by default but to reflect its stability it has been moved out of the `experimental` configuration object.
40
+
#### `types`{lang="yml"}
41
+
* Only `'composition'` types will be supported in v11, in line with Vue I18n v12.
41
42
42
-
### Remove `restructureDir` migration path
43
-
To ease migration in v9 it was possible to disable the new directory structure by setting `restructureDir: false`, this has now been removed and we recommend using the default value of `'i18n'`.
43
+
#### `routesNameSeparator`{lang="yml"}
44
+
* This was documented as internal, use cases for end-users are unclear.
45
+
46
+
#### `defaultLocaleRouteNameSuffix`{lang="yml"}
47
+
* This was documented as internal, use cases for end-users are unclear.
48
+
49
+
50
+
### Promoted options
51
+
These options are stable and are now enabled by default, some have been renamed to better reflect their purpose.
The following functions have been removed from the Nuxt context.
48
-
*`$resolveRoute()`{lang="ts"}
49
-
*`$localeLocation()`{lang="ts"}
50
65
51
-
Steps to migrate
52
-
*`$resolveRoute()`{lang="ts"} -> use `$localeRoute()` instead
53
-
*`$localeLocation()`{lang="ts"} -> use `$localeRoute()` instead
66
+
#### `$resolveRoute()`{lang="ts"}
67
+
* Use `$localeRoute()`{lang="ts"} instead
68
+
69
+
#### `$localeLocation()`{lang="ts"}
70
+
* Use `$localeRoute()`{lang="ts"} instead
71
+
72
+
73
+
### Deprecated context functions
74
+
These Nuxt context functions have been deprecated and will be removed in v11.
75
+
76
+
#### `$localeHead()`{lang="ts"}
77
+
* Deprecated due to limited use cases, the `useLocaleHead` composable offers the same functionality and is easier to use in combination with `useHead`.
54
78
55
-
###Drop `bundle.optimizeTranslationDirective`
56
-
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.
79
+
#### `$getRouteBaseName()`{lang="ts"}
80
+
* Deprecated in favor of the same function under a new name: `$routeBaseName()`{lang="ts"}, to be consistent with the other context functions and their composable counterparts.
57
81
58
-
### Drop `experimental.generatedLocaleFilePathFormat`
59
-
File paths (e.g. locale files, vue-i18n configs) configured for this module are now removed entirely making this option obsolete.
60
82
61
-
### Removed exports from generated options files.
83
+
##Generated options
62
84
The generated options files in your projects are meant for internal use by this module at runtime and should never be used, more properties may be removed in the future.
63
85
64
86
The following exports have been removed from the generated options files (`#build/i18n.options.mjs` and `#internal/i18n/options.mjs`):
@@ -75,7 +97,7 @@ Reasons for removal:
75
97
* These are no longer used by the module and might expose vulnerable information in the final build
76
98
* Some options are now used as static values for better tree-shaking resulting in a smaller project build.
77
99
78
-
### Removed options from runtime config
100
+
##Runtime config
79
101
Several options set in the runtime config were only used to transfer build-time configuration to runtime and changing these at runtime could cause issues.
80
102
81
103
Instead of setting these on runtime config we now treat them as compiler constants, this way we can tree-shake any unused logic from a project build.
0 commit comments