Skip to content

Commit

Permalink
docs: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Feb 17, 2021
1 parent 060361b commit 81347d1
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ Introducing my awesome Nuxt module!

The first level of directories in the `content/` folder are the locales used with [nuxt-i18n](https://github.com/nuxt-community/i18n-module) defined in your `nuxt.config.js`.

By default, only the default `en` locale is defined, **you have to create a `content/en/` directory** to make it work.
If not `en` directory is specified, all the files inside `content/` will be considered as English:

```bash
content/
1.index.md
2.about.md
setting.json
```

To add another locale, setup the

You can override the locales in your `nuxt.config.js`:

Expand All @@ -55,7 +64,6 @@ import { withDocus } from 'docus'

export default withDocus({
i18n: {
defaultLocale: 'en',
locales: () => [{
code: 'en',
iso: 'en-US',
Expand All @@ -71,6 +79,19 @@ export default withDocus({
})
```

Then you need to set this directory structure:

```bash
content/
en/
1.index.md
2.about.md
fr/
1.index.md
2.about.md
setting.json
```

<alert type="info">

As explained in the [Nuxt config](/usage/configuration#nuxt) section, we use `defu.arrayFn` to merge your config. You can override the `i18n.locales` array by using a function, or you can pass an array to concat with the default one (which has only the `en` locale).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/content/fr/1.index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OK
4 changes: 2 additions & 2 deletions theme/plugins/i18n.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function ({ app, store }, inject) {
app.i18n.onLanguageSwitched = () => store.dispatch('fetchCategories')
export default function ({ app, $docus }, inject) {
app.i18n.onLanguageSwitched = () => $docus.fetchCategories()

// Generate local path for static contents.
// This helper does not respect `router.trailingSlash`
Expand Down

1 comment on commit 81347d1

@vercel
Copy link

@vercel vercel bot commented on 81347d1 Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.