Skip to content

Commit 225991f

Browse files
authored
Editorial fix (#1098)
1 parent ebfab3d commit 225991f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/.ja/guide/advanced/typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const i18n = createI18n<[MessageSchema], 'en-US' | 'ja-JP'>({
4040
})
4141
```
4242

43-
上記のコードでは、`createI18n``messages`オプションに指定する`en-US`メッセージリソースから型を定義しています。この定義した型は、VueI18nで取り扱うメッセージリソースのマスター的なスキーマです。つまり、アプリケーションにおいて、**single-of-truth**のリソースとして定義できるようになります。メッセージリソースからスキーマとして定義した型を`createI18n`の型パラメータの第1引数に指定することで、他の locale において型安全なリソースを定義することが可能になります。
43+
上記のコードでは、`createI18n``messages`オプションに指定する`en-US`メッセージリソースから型を定義しています。この定義した型は、VueI18nで取り扱うメッセージリソースのマスター的なスキーマです。つまり、アプリケーションにおいて、**single source of truth**のリソースとして定義できるようになります。メッセージリソースからスキーマとして定義した型を`createI18n`の型パラメータの第1引数に指定することで、他の locale において型安全なリソースを定義することが可能になります。
4444

45-
`createI18n`の型パラメータの第2引数には、取り扱う locale を指定します。これにより、第1引数で指定されたリソースの型を元に、この第2引数に指定された locale ごとに型チェックをします。上記のコード例では、`locale`オプションにも指定されているメイン locale となる`en-US`、そして`ja-JP`が指定されています。この状態で、typescript のコンパイルすると以下のようなエラーが発生し、`messages`オプションに `ja-JP` のリソースが定義されていないことをチェックすることができます。
45+
`createI18n`の型パラメータの第2引数には、取り扱う locale を指定します。これにより、第1引数で指定されたリソースの型を元に、この第2引数に指定された locale ごとに型チェックをします。上記のコード例では、`locale`オプションにも指定されているメイン locale となる`en-US`、そして`ja-JP`が指定されています。この状態で、typescript のコンパイルすると以下のようなエラーが発生し、`messages`オプションに `ja-JP` のリソースが定義されていないことをチェックすることができます。
4646

4747
```sh
4848
$ npx tsc
@@ -250,7 +250,7 @@ VueI18nでは、TypeScriptのinterfaceを拡張できる機能を利用して、
250250
251251
VueI18nでは以下のinterfaceを提供しています。
252252
253-
- `DefineLocaleMessage`: Locale messages のスキーマをグローバルに定義するための interface
253+
- `DefineLocaleMessage`: Locale messages のスキーマをグローバルに定義するための interface
254254
- `DefineDateTimeFormat`: Datetime formats のスキーマをグローバルに定義するための interface
255255
- `DefineNumberFormat`: Number formats のスキーマをグローバルに定義するための interface
256256

docs/guide/advanced/typescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ const i18n = createI18n<[MessageSchema], 'en-US' | 'ja-JP'>({
4141
})
4242
```
4343

44-
The above code defines a type from the `en-US` message resource specified in the `messages` option of `createI18n`. This defined type is the master-like schema for message resources handled with VueI18n. This means that you can define it **as a single-of-truth** resource in your application. You can define a type-safe resource in other locales by specifying the type defined as a schema from a message resource as the first argument of the type parameter of `createI18n`.
44+
The above code defines a type from the `en-US` message resource specified in the `messages` option of `createI18n`. This defined type is the master-like schema for message resources handled with VueI18n. This means that you can define it **as a single source of truth** resource in your application. You can define a type-safe resource in other locales by specifying the type defined as a schema from a message resource as the first argument of the type parameter of `createI18n`.
4545

46-
The second argument of the type parameter of `createI18n` is the locale to handle. The second argument of the type parameter of `createI18n` specifies the locale to be handled. With this, type checking is performed for each locale specified in the second argument, based on the type of the resource specified in the first argument. In the above code example, `en-US` and `ja-JP` are specified as the main locale, which is also specified in the `locale` option. If you compile typescript in this state, you will get the following error to check that no `ja-JP` resource is defined in the `messages` option.
46+
The second argument of the type parameter of `createI18n` is the locale to handle. The second argument of the type parameter of `createI18n` specifies the locale to be handled. With this, type checking is performed for each locale specified in the second argument, based on the type of the resource specified in the first argument. In the above code example, `en-US` and `ja-JP` are specified as the main locale, which is also specified in the `locale` option. If you compile typescript in this state, you will get the following error to check that no `ja-JP` resource is defined in the `messages` option.
4747

4848
```sh
4949
$ npx tsc
@@ -249,7 +249,7 @@ If your project uses all resources as global scope, it is very convenient to han
249249
250250
VueI18n provides the following interfaces:
251251
252-
- `DefineLocaleMessage`: Interface to globally define the schema for Locale messages
252+
- `DefineLocaleMessage`: Interface to globally define the schema for Locale messages
253253
- `DefineDateTimeFormat`: Interface to globally define the schema for Datetime formats
254254
- `DefineNumberFormat`: Interface to globally define the schema for Number formats
255255

0 commit comments

Comments
 (0)