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/advanced/composition.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -299,6 +299,12 @@ The above code sets the `useI18n` option to `useScope: 'global'`, which allows `
299
299
300
300
Then you can compose using the functions and properties exposed from the Composer instance.
301
301
302
+
:::tip NOTE
303
+
If you set `useI18n` to `messages`, `datetimeFormats`, and `numberFormats` together `useScope: 'global’`, **they will be merged into global scope**. That is, they will be managed by `messages`, `datetimeFormasts`, and `numberFormats` of the global scope Composer instance.
304
+
305
+
And also, if [`global` is specified in i18n custom blocks](../advanced/sfc#define-locale-messages-for-global-scope) (e.g. `<i18n global>{ … }</i18n>`), the locale messags defined in the blocks are merged with the global scope.
306
+
:::
307
+
302
308
### Implicit with injected properties and functions
303
309
304
310
Another way to refer a global scope Composer instance is through properties and functions implicitly injected into the component.
Copy file name to clipboardExpand all lines: docs/advanced/sfc.md
+24-3Lines changed: 24 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,7 +173,7 @@ const config: UserConfig = {
173
173
exportdefaultconfig
174
174
```
175
175
176
-
## Define Locale Messages Importing
176
+
## Define locale lessages importing
177
177
178
178
You can use `src` attribute:
179
179
@@ -209,7 +209,7 @@ You can use `locale` attribute:
209
209
210
210
In the above example, since the `locale` attribute is set to `en`, the locale messages defined in `i18n` custom blocks can be used as a resource for locale messages of `en`.
211
211
212
-
## Define Multiple Locale Messages
212
+
## Define multiple locale lessages
213
213
214
214
You can use locale messages with multiple `i18n` custom blocks.
215
215
@@ -231,7 +231,7 @@ In the above, first custom block load the common locale message with `src` attri
231
231
232
232
In this way, multiple custom blocks useful when want to be used as module.
233
233
234
-
## Locale Messages Other Formats
234
+
## Locale messages other formats
235
235
236
236
`i18n` custom blocks supports resource formats other than `json`.
237
237
@@ -271,6 +271,27 @@ The `i18n` custom blocks below of `json5` format:
271
271
</i18n>
272
272
```
273
273
274
+
## Define locale messages for global scope
275
+
276
+
You can use define locale messages for global scope with `global` attribute:
277
+
278
+
```html
279
+
<i18nglobal>
280
+
{
281
+
"en": {
282
+
"hello": "hello world!"
283
+
}
284
+
}
285
+
</i18n>
286
+
```
287
+
288
+
In the above example, since the `global` attribute is set, the locale messages defined in `i18n` custom blocks can be merged as a resource for locale messages of global scope.
289
+
290
+
:::warning NOTICE
291
+
The locale messages for global scope defined in i18n custom blocks are available **only composition API mode**. You need to run `useI18n` option to `useScope: 'global'` at `setup`. About details, see the [Composition API](/advanced/composition).
292
+
:::
293
+
294
+
274
295
## Vue CLI
275
296
276
297
[Vue CLI](https://github.com/vuejs/vue-cli) hides the webpack configuration, so, if we want to add support to the `<i18n>` tag inside a single file component we need to modify the existing configuration.
Copy file name to clipboardExpand all lines: docs/migration/features.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,3 +59,7 @@ export default {
59
59
For Datetime localization, since Vue I18n v9, we also offer the DatetimeFormat component like the [NumberFormat component](../essentials/number#custom-formatting).
60
60
61
61
See the [Datetime localization custom formatting](../essentials/datetime#custom-formatting)
62
+
63
+
## i18n Custom Block
64
+
65
+
- See the [`global` attribute](../advanced/sfc#define-locale-messages-for-global-scope)
0 commit comments