Skip to content

Commit e4f6bd8

Browse files
authored
docs: add scope resolving section (#862)
* docs: add scope resolving section * fix: formatting * docs: add scope resolving on datetime component and numberformat component * docs: fix
1 parent 295f0a2 commit e4f6bd8

File tree

6 files changed

+85
-0
lines changed

6 files changed

+85
-0
lines changed

docs/guide/advanced/component.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,33 @@ The following output:
241241
<!-- ... -->
242242
</div>
243243
```
244+
245+
## Scope resolving
246+
247+
The [Scope](../essentials/scope.md) resolving of Translation component is `parent` as default.
248+
249+
It meas that Translation component uses the scope that is enabled in the parent component that uses it.
250+
251+
If the parent component has `useI18n` in `useScope: 'global'`, it will use Global Scope, else if `useScope: 'local'`, it will use the Local Scope of the parent component.
252+
253+
However, You sometimes meet the warning message on your browser console the following:
254+
255+
```
256+
[intlify] Not found parent scope. use the global scope.
257+
```
258+
259+
This message is displayed in the case that you have not run `useI18n` in the parent component that uses the Translation component.
260+
261+
In that situation, the Scope of the Translation Component will be fallback to the global scope as said the warning message.
262+
263+
A workaround to suppress this warning is to specify `global` as the `scope` property of Translation component.
264+
265+
```html
266+
<i18n-t keypath="message.foo" scope="global">
267+
...
268+
</i18n-t>
269+
```
270+
271+
:::tip NOTE
272+
This warning is not output to the browser console in production builds.
273+
:::

docs/guide/essentials/datetime.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ It is possible to specify multiple scoped slots at the same time:
155155
:::tip NOTE
156156
Full list of the supported scoped slots as well as other `i18n-d`, properties can be found on [API Reference](../../api/component.html#datetimeformat).
157157
:::
158+
159+
## Scope resolving
160+
161+
The Scope resolving of DatetimeFormat component is same as Translation component.
162+
163+
See the [here](../advanced/component.md#scope-resolving)

docs/guide/essentials/number.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,9 @@ It is possible to specify multiple scoped slots at the same time:
168168
:::tip NOTE
169169
Full list of the supported scoped slots as well as other `i18n-n`, properties can be found on [API Reference](../../api/component.html#numberformat).
170170
:::
171+
172+
## Scope resolving
173+
174+
The Scope resolving of NumberFormat component is same as Translation component.
175+
176+
See the [here](../advanced/component.md#scope-resolving)

docs/ja/guide/advanced/component.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,34 @@ The following output:
241241
<!-- ... -->
242242
</div>
243243
```
244+
245+
246+
## Scope resolving
247+
248+
The [Scope](../essentials/scope.md) resolving of Translation component is `parent` as default.
249+
250+
It meas that Translation component uses the scope that is enabled in the parent component that uses it.
251+
252+
If the parent component has `useI18n` in `useScope: 'global'`, it will use Global Scope, else if `useScope: 'local'`, it will use the Local Scope of the parent component.
253+
254+
However, You sometimes meet the warning message on your browser console the following:
255+
256+
```
257+
[intlify] Not found parent scope. use the global scope.
258+
```
259+
260+
This message is displayed in the case that you have not run `useI18n` in the parent component that uses the Translation component.
261+
262+
In that situation, the Scope of the Translation Component will be fallback to the global scope as said the warning message.
263+
264+
A workaround to suppress this warning is to specify `global` as the `scope` property of Translation component.
265+
266+
```html
267+
<i18n-t keypath="message.foo" scope="global">
268+
...
269+
</i18n-t>
270+
```
271+
272+
:::tip NOTE
273+
This warning is not output to the browser console in production builds.
274+
:::

docs/ja/guide/essentials/datetime.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ DatetimeFormatコンポーネントにはいくつかのpropsがあります。
155155
:::tip 備考
156156
サポートされているスコープ付きスロットやその他`i18n-d`のプロパティの一覧は[API リファレンス](../../api/component.html#datetimeformat)で確認できます。
157157
:::
158+
159+
## スコープの解決
160+
161+
DatetimeFormat コンポーネントのスコープ解決は Translation コンポーネントと同じです。
162+
163+
詳細は、[こちら](../advanced/component.md#scope-resolving)のドキュメントをお読みください。

docs/ja/guide/essentials/number.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,9 @@ NumberFormatコンポーネントにはいくつかのpropsがあります。
144144
:::tip 備考
145145
サポートされているスコープ付きスロットとその他`i18n-n`のプロパティの一覧は[API リファレンス](../../api/component.html#numberformat)で確認できます。
146146
:::
147+
148+
## スコープの解決
149+
150+
NumberFormat コンポーネントのスコープ解決は Translation コンポーネントと同じです。
151+
152+
詳細は、[こちら](../advanced/component.md#scope-resolving)のドキュメントをお読みください。

0 commit comments

Comments
 (0)