Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #57 from panter/features/global-options-docs
Browse files Browse the repository at this point in the history
feat(docs): document vue-i18next global options
  • Loading branch information
claudiocro authored Jan 23, 2019
2 parents 3c9a691 + a543c0c commit edd7f3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 3 additions & 5 deletions docs/guide/i18n-options.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# i18nOptions


## namespaces

The namespace will be loaded with (loadNamespaces)[http://i18next.com/docs/api/#load-namespaces],so one can lazy load namespaces for components.
The namepace will not be loaded automatically, see [loadComponentNamespace](/guide/started.html#init)

```javascript
const locales = {
Expand Down Expand Up @@ -51,7 +50,6 @@ const app = {
}
};


i18next.init({
lng: "en",
fallbackLng: "en",
Expand All @@ -63,7 +61,7 @@ i18next.init({
const i18n = new VueI18next(i18next);

Vue.component("app", {
i18nOptions: { namespaces: ["app","common"] },
i18nOptions: { namespaces: ["app", "common"] },
template: `<strong>{{ $t("promise") }}</strong>`
});
```
Expand Down Expand Up @@ -97,6 +95,7 @@ Vue.component('app', {
```

## messages

Translations can not only be defined in translation files but also in the `i18nOptions`.

```javascript
Expand Down Expand Up @@ -142,4 +141,3 @@ Vue.component('app', {
</div>`,
});
```

8 changes: 8 additions & 0 deletions docs/guide/started.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ new Vue({
i18n: i18n,
});
```

## Init options

| Name | Description |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **loadComponentNamespace** | When using the [namespace options](/guide/i18n-options.md#namespaces) the namespaces will be loaded with [loadNamespaces](https://www.i18next.com/overview/api#loadnamespaces),<br>so one can lazy load namespaces for components. |
| **bindI18n** | Listen for `i18next` events and refreshes the component.<br>Check the [i18next documentation for more infos](https://www.i18next.com/overview/api#events) |
| **bindStore** | Listen for `i18next` store events and refreshes the component.<br>Check the [i18next store documentation for more infos](https://www.i18next.com/overview/api#store-events) |

0 comments on commit edd7f3e

Please sign in to comment.