Skip to content

Commit

Permalink
docs: Add usage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Skelton committed Mar 26, 2021
1 parent 37eb5c2 commit 200d8bb
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,41 @@ yarn add i18next-async-backend
import i18next from 'i18next'
import AsyncBackend from 'i18next-async-backend'

const resources = {
es: () => import('./locales/es/translation.json'),
}

i18next.use(AsyncBackend).init({
backend: {
resources: {
en: {},
},
},
backend: { resources },
})
```

## Recipes

### Single namespace

```js
const resources = {
en: () => import('./locales/en/translation.json'),
es: () => import('./locales/es/translation.json'),
}
```

### Multiple namespaces

```js
const resources = {
en: {
common: () => import('./locales/en/common.json'),
glossary: () => import('./locales/en/glossary.json'),
},
es: {
common: () => import('./locales/es/common.json'),
glossary: () => import('./locales/es/glossary.json'),
},
}
```

## Releasing

This extension uses [semantic-release](https://github.com/semantic-release/semantic-release) to automatically increment the release based on the commit message. Checkout [their docs](https://github.com/semantic-release/semantic-release#how-does-it-work) for more details.

0 comments on commit 200d8bb

Please sign in to comment.