Skip to content

Commit

Permalink
📝 docs(gitbook): tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Apr 19, 2017
1 parent 024b970 commit bb95130
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 105 deletions.
16 changes: 8 additions & 8 deletions gitbook/en/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Internationalization plugin of Vue.js
* [Looking for 5.x Docs?](https://kazupon.github.io/vue-i18n/old/)
* [Release Notes](https://github.com/kazupon/vue-i18n/releases)
* [Installation](installation.md)
* [Getting Started](started.md)
* [Getting started](started.md)
* [Formatting](formatting.md)
* [Pluralization](pluralization.md)
* [DateTime Localization](datetime.md)
* [Locale Messages Syntax](messages.md)
* [Fallback Translation](fallback.md)
* [Component Based Translation](component.md)
* [Single File Component](sfc.md)
* [Hot Reload](hot-reload.md)
* [DateTime localization](datetime.md)
* [Locale messages syntax](messages.md)
* [Fallback localization](fallback.md)
* [Component based localization](component.md)
* [Single file components](sfc.md)
* [Hot reloading](hot-reload.md)
* [Migrations](migrations.md)
* [API References](api.md)
* [API references](api.md)
80 changes: 40 additions & 40 deletions gitbook/en/api.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# API References
# API references


## Vue Constructor Options
## Vue constructor options

### i18n

- **Type:** `I18nOptions`

Component based translation option.
Component based localization option.

- **See also:** [`VueI18n` class constructor options](#constructor-options)


## Vue Static Properties
## Vue static properties

### version

- **Type:** `string`

vue-i18n version.
vue-i18n version.

### availabilities

- **Type:** `IntlAvailability`

Whether the following internationalization features are available:
Whether the following internationalization features are available:

- `{boolean} dateTimeFormat`: locale sensitive datetime formatting

The above internationalization features are depends on [the browser environmens](http://kangax.github.io/compat-table/esintl/), due to implement with ECMAScript Internationalization API (ECMA-402).
The above internationalization features are depends on [the browser environmens](http://kangax.github.io/compat-table/esintl/), due to implement with ECMAScript Internationalization API (ECMA-402).

## Vue injected methods

Expand All @@ -41,7 +41,7 @@ The above internationalization features are depends on [the browser environmens]

- **Return:** `string`

Translate the locale message of `key`. Translate in preferentially component locale messages than global locale messages. If not specified component locale messages, translate with global locale messages. If you specified `locale`, translate the locale messages of `locale`. If you specified `key` of list / named formatting local messages, you must specify `values` too. For `values` more details see [Formatting](formatting.md).
Localize the locale message of `key`. Localize in preferentially component locale messages than global locale messages. If not specified component locale messages, localize with global locale messages. If you specified `locale`, localize the locale messages of `locale`. If you specified `key` of list / named formatting local messages, you must specify `values` too. For `values` more details see [Formatting](formatting.md).

### $tc

Expand All @@ -52,7 +52,7 @@ The above internationalization features are depends on [the browser environmens]

- **Return:** `string`

Translate the locale message of `key` with pluralization. Translate in preferentially component locale messages than global locale messages. If not specified component locale messages, translate with global locale messages. If you will specify string value to `values`, translate the locale messages of value. If you will specify Array or Object value to `values`, you must specify with `values` of [$t](#t).
Localize the locale message of `key` with pluralization. Localize in preferentially component locale messages than global locale messages. If not specified component locale messages, localize with global locale messages. If you will specify string value to `values`, localize the locale messages of value. If you will specify Array or Object value to `values`, you must specify with `values` of [$t](#t).

### $te

Expand Down Expand Up @@ -86,9 +86,9 @@ The above internationalization features are depends on [the browser environmens]

- **Read only**

Get a `VueI18n` instance. If you are specify.
Get a `VueI18n` instance. If you are specify.

If you have specified an `i18n` option at component options, you will be able to get a `VueI18n` instance at the component, Otherwise, you will be able get root `VueI18n` instance.
If you have specified an `i18n` option at component options, you will be able to get a `VueI18n` instance at the component, Otherwise, you will be able get root `VueI18n` instance.


## `VueI18n` class
Expand All @@ -105,31 +105,31 @@ You can specify the below some options of [`I18nOptions` constructor options](#t

- **Default:** `'en-US'`

The locale of translation.
The locale of localization.

#### fallbackLocale

- **Type:** `Locale`

- **Default:** `'en-US'`

The locale of fallback translation.
The locale of fallback localization.

#### messages

- **Type:** `LocaleMessages`

- **Default:** `{}`

The locale messages of translation.
The locale messages of localization.

#### dateTimeFormats

- **Type:** `DateTimeFormats`

- **Default:** `{}`

The datetime formats of localization.
The datetime formats of localization.

- **See also:** [`DateTimeFormats` type](#type-definitions-for-flowtype).

Expand All @@ -139,47 +139,47 @@ The datetime formats of localization.

- **Default:** Built in formatter

The formatter that implemented with `Formatter` interface.
The formatter that implemented with `Formatter` interface.

#### missing

- **Type:** `MissingHandler`

- **Default:** `null`

A hander for translation missing. The handler gets called with the translation target locale, translation path key and the Vue instance.
A hander for localization missing. The handler gets called with the localization target locale, localization path key and the Vue instance.

If missing hander is assigned, and occured translation missing, it's not warned.
If missing hander is assigned, and occured localization missing, it's not warned.

#### fallbackRoot

- **Type:** `Boolean`

- **Default:** `true`

In the component translation, whether to fall back to root level (global) translation when translation fails.
In the component localization, whether to fall back to root level (global) localization when localization fails.

If `false`, it's warned, and is returned the key.
If `false`, it's warned, and is returned the key.

#### sync

- **Type:** `Boolean`

- **Default:** `true`

Whether synchronize the root level locale to the component translation locale.
Whether synchronize the root level locale to the component localization locale.

If `false`, regardless of the root level locale, translate for each component locale.
If `false`, regardless of the root level locale, localize for each component locale.

### silentTranslationWarn

- **Type:** `Boolean`

- **Default:** `false`

Whether suppress warnings outputted when translation fails.
Whether suppress warnings outputted when localization fails.

If `true`, supress translation fail warnings.
If `true`, supress localization fail warnings.

### Properties

Expand All @@ -189,57 +189,57 @@ If `true`, supress translation fail warnings.

- **Read/Write**

The locale of translation.
The locale of localization.

#### fallbackLocale

- **Type:** `Locale`

- **Read/Write**

The locale of fallback translation.
The locale of fallback localization.

#### messages

- **Type:** `LocaleMessages`

- **Read only**

The locale messages of translation.
The locale messages of localization.

#### dateTimeFormats

- **Type:** `DateTimeFormats`

- **Read only**

The datetime formats of localization.
The datetime formats of localization.

#### missing

- **Type:** `MissingHandler`

- **Read/Write**

A hander for translation missing.
A hander for localization missing.

#### formatter

- **Type:** `Formatter`

- **Read/Write**

The formatter that implemented with `Formatter` interface.
The formatter that implemented with `Formatter` interface.

#### silentTranslationWarn

- **Type:** `boolean`

- **Read/Write**

Whether suppress warnings outputted when translation fails.
Whether suppress warnings outputted when localization fails.

### methods
### Methods

#### getLocaleMessage( locale )

Expand All @@ -248,23 +248,23 @@ Whether suppress warnings outputted when translation fails.

- **Return:** `LocaleMessage`

Get the locale message of locale.
Get the locale message of locale.

#### setLocaleMessage( locale, message )

- **Arguments:**
- `{Locale} locale`
- `{LocaleMessage} message`

Set the locale message of locale.
Set the locale message of locale.

#### mergeLocaleMessage( locale, message )

- **Arguments:**
- `{Locale} locale`
- `{LocaleMessage} message`

Merge the registered locale messages with the locale message of locale.
Merge the registered locale messages with the locale message of locale.

#### t( key, [locale], [values] )

Expand Down Expand Up @@ -305,23 +305,23 @@ Merge the registered locale messages with the locale message of locale.

- **Return:** `DateTimeFormat`

Get the datetime format of locale.
Get the datetime format of locale.

#### setDateTimeFormat ( locale, format )

- **Arguments:**
- `{Locale} locale`
- `{DateTimeFormat} format`

Set the datetime format of locale.
Set the datetime format of locale.

#### mergeDateTimeFormat ( locale, format )

- **Arguments:**
- `{Locale} locale`
- `{DateTimeFormat} format`

Merge the registered datetime formats with the datetime format of locale.
Merge the registered datetime formats with the datetime format of locale.

#### d( value, [key], [locale] )

Expand All @@ -332,10 +332,10 @@ Merge the registered datetime formats with the datetime format of locale.

- **Return:** `string`

This is the same as `$d` method of Vue instance method. More detail see [$d](#$d).
This is the same as `$d` method of Vue instance method. More detail see [$d](#$d).


## Type Definitions for FlowType
## Type definitions for flowType

```
declare type Path = string;
Expand Down
14 changes: 7 additions & 7 deletions gitbook/en/component.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Component Based Translation
# Component based localization

In general, Locale info (e.g. `locale`,`messages`, etc) is set as constructor option of `VueI18n` instance, and it set `i18n` option as root Vue instance. Thereby you globally can translate with using `$t` or `$tc` in the root Vue instance are composed some component. you manage locale info for each component and it translate, it was better is convenient due to Vue is component oriented.
In general, Locale info (e.g. `locale`,`messages`, etc) is set as constructor option of `VueI18n` instance, and it set `i18n` option as root Vue instance. Thereby you globally can localize with using `$t` or `$tc` in the root Vue instance are composed some component. you manage locale info for each component and it localize, it was better is convenient due to Vue is component oriented.

The below component based translation example:
The following component based localization example:

```javascript
// setup locale info for root Vue instance
Expand Down Expand Up @@ -47,7 +47,7 @@ new Vue({
}).$mount('#app')
```

Template the following:
Template the below:

```html
<div id="app">
Expand All @@ -56,7 +56,7 @@ Template the following:
</div>
```

Output the following:
Output the below:

```html
<div id="app">
Expand All @@ -68,6 +68,6 @@ Output the following:
</div>
```

As in the example above, if the component doesn't have the locale message, it fallbacks and translates global locale message. Also translate it using global locale (in the above example, `locale: 'ja'`).
As in the example above, if the component doesn't have the locale message, it fallbacks and localizes global locale message. Also localize it using global locale (in the above example, `locale: 'ja'`).

If you hope translate in the component locale, you can realize with `sync: false` and `locale` in `i18n` option.
If you hope localize in the component locale, you can realize with `sync: false` and `locale` in `i18n` option.
8 changes: 4 additions & 4 deletions gitbook/en/datetime.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DateTime Localization
# DateTime localization

You can localize the datetime with your definition formats.

DateTime formats the bellow:
DateTime formats the below:

```javascript
const dateTimeFormats = {
Expand Down Expand Up @@ -38,7 +38,7 @@ new Vue({
}).$mount('#app')
```

Template the bellow:
Template the below:

```html
<div id="app">
Expand All @@ -47,7 +47,7 @@ Template the bellow:
</div>
```

Output the bellow:
Output the below:

```html
<div id="app">
Expand Down
Loading

0 comments on commit bb95130

Please sign in to comment.