Skip to content

Commit

Permalink
feat(docs): migrate docs to Nuxt Content (nuxt-modules#864)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
  • Loading branch information
debs-obrien and rchl authored Aug 26, 2020
1 parent 4b4e78e commit affb845
Show file tree
Hide file tree
Showing 52 changed files with 10,070 additions and 2,071 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nuxt-i18n: <!-- ex: 5.9.0 -->
nuxt: <!-- ex: 2.0.0 -->

### Nuxt configuration
#### [mode](https://nuxtjs.org/api/configuration-mode): <!--universal is the default, please insert X where appropriate -->
#### [mode](https://nuxtjs.org/guides/configuration-glossary/configuration-mode): <!--universal is the default, please insert X where appropriate -->
- [] universal
- [] spa

Expand Down
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ npm run docs:dev # npm

- Write some doc by editing files in `docs/` directory

> If you're adding new pages, make sure you add them to the table of contents in `docs/.vuepress/config`
> Please make sure all languages are in sync. If you don't speak a particular language, put an english text in place of changed or added text.
> Please make sure all languages are in sync. If you don't speak a particular language, insert english text in place.
- Commit and push your changes
- Once you're done, submit that shiny PR!
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img width="300" height="270" src="./assets/nuxt-i18n-logo.png" alt="nuxt-i18n logo">
<img src="./docs/static/preview.png" alt="nuxt-i18n logo">
</p>

[![](https://david-dm.org/nuxt-community/i18n-module/status.svg?style=flat-square)](https://david-dm.org/nuxt-community/i18n-module)
Expand Down
25 changes: 0 additions & 25 deletions deploy_doc

This file was deleted.

10 changes: 10 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
112 changes: 0 additions & 112 deletions docs/.vuepress/config.js

This file was deleted.

40 changes: 27 additions & 13 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
<div align="center">
<img width="300" height="270" src="../assets/nuxt-i18n-logo.png" alt="nuxt-i18n logo">
</div>

**nuxt-i18n** provides i18n features for your Nuxt project:

* [vue-i18n](https://github.com/kazupon/vue-i18n) integration
* Automatic routes generation prefixed with locale code
* SEO
* Translations messages lazy-loading
* Redirection based on browser language
* Different domain names for each language
* Vuex store module with current locale & messages
# i18n

## Setup

Install dependencies:

```bash
yarn install
```

## Development

```bash
yarn dev
```

## Static Generation

This will create the `dist/` directory for publishing to static hosting:

```bash
yarn generate
```

To preview the static generated app, run `yarn start`

For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).
38 changes: 24 additions & 14 deletions docs/api/README.md → docs/content/en/api.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---
sidebar: auto
title: API Reference
description: 'API Reference'
position: 20
category: Api
---

# API Reference

## Extension of Vue

::: tip NOTE
<alert type="info">

All [Vue I18n properties and methods](http://kazupon.github.io/vue-i18n/api/#vue-injected-methods) (like `$t`, `$i18n`, `v-t` directive and others) are also available even though they are not listed here. Below are only the ones that are added by `nuxt-i18n`.
:::

</alert>

### Methods

Expand All @@ -24,9 +26,11 @@ All [Vue I18n properties and methods](http://kazupon.github.io/vue-i18n/api/#vue

See also [Basic usage - nuxt-link](../basic-usage.html#nuxt-link).

::: warning
<alert type="warning">

In `no_prefix` strategy, passing `locale` other than the current one is not supported.
:::

</alert>

#### switchLocalePath

Expand All @@ -40,9 +44,11 @@ In `no_prefix` strategy, passing `locale` other than the current one is not supp

See type definition for [Location](https://github.com/vuejs/vue-router/blob/f40139c27a9736efcbda69ec136cb00d8e00fa97/types/router.d.ts#L125).

::: warning
<alert type="warning">

In `no_prefix` strategy, passing `locale` other than the current one is not supported.
:::

</alert>

#### getRouteBaseName

Expand All @@ -63,9 +69,11 @@ In `no_prefix` strategy, passing `locale` other than the current one is not supp

See also [Basic usage - nuxt-link](../basic-usage.html#nuxt-link).

::: warning
<alert type="warning">

In `no_prefix` strategy, passing `locale` other than the current one is not supported.
:::

</alert>

#### $nuxtI18nSeo

Expand All @@ -77,9 +85,11 @@ In `no_prefix` strategy, passing `locale` other than the current one is not supp

## Extension of VueI18n

::: tip
<alert type="info">

Instance of [VueI18n class](http://kazupon.github.io/vue-i18n/api/#vuei18n-class) (see its [properties and methods](http://kazupon.github.io/vue-i18n/api/#properties)) is exposed as `$i18n` on Vue instance and Vuex Store but as `i18n` on Nuxt `context.app`.
:::

</alert>

### Methods

Expand Down Expand Up @@ -145,7 +155,7 @@ Instance of [VueI18n class](http://kazupon.github.io/vue-i18n/api/#vuei18n-class

- **Type**: [`VueI18n`](#extension-of-vuei18n)

See also [Nuxt context](https://nuxtjs.org/api/context#the-context).
See also [Nuxt context](https://nuxtjs.org/guides/concepts/context-helpers).

Can be accessed from `asyncData` and wherever `context` is available.

Expand Down
17 changes: 10 additions & 7 deletions docs/basic-usage.md → docs/content/en/basic-usage.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Basic Usage
---
title: Basic Usage
description: 'The fastest way to get started with **nuxt-i18n** is to define the supported `locales` list and to provide some translation messages to **vue-i18n** via the `vueI18n` option:'
position: 3
category: Guide
---

The fastest way to get started with **nuxt-i18n** is to define the supported `locales` list and to provide some translation messages to **vue-i18n** via the `vueI18n` option:

```js
```js{}[nuxt.config.js]
{
modules: [
'nuxt-i18n'
Expand Down Expand Up @@ -52,7 +57,7 @@ When rendering internal links in your app using `<nuxt-link>`, you need to get p
<!-- It's also allowed to omit 'name' and 'path'. -->
<nuxt-link :to="localePath({ params: { slug: 'ball' } })">{{ category.title }}</nuxt-link>
```
Note that `localePath` can use the route's unprefixed path, which must start with `'/'` or the route's base name to generate the localized URL. The base name corresponds to the names Nuxt generates when parsing your `pages/` directory, more info in [Nuxt's doc](https://nuxtjs.org/guide/routing).
Note that `localePath` can use the route's unprefixed path, which must start with `'/'` or the route's base name to generate the localized URL. The base name corresponds to the names Nuxt generates when parsing your `pages/` directory, more info in [Nuxt's doc](https://nuxtjs.org/guides/features/file-system-routing).

* `switchLocalePath` – Returns a link to the current page in another language:

Expand All @@ -63,9 +68,7 @@ Note that `localePath` can use the route's unprefixed path, which must start wit

For convenience, these methods are also available in the app's context:

```js
// ~/plugins/myplugin.js

```js{}[/plugins/myplugin.js]
export default ({ app }) => {
// Get localized path for homepage
const localePath = app.localePath('index')
Expand All @@ -74,7 +77,7 @@ export default ({ app }) => {
}
```

* `localeRoute` <Badge text="v6.12+" /> – Returns the route object for a given page. It works like `localePath` but returns full route resolved by Vue Router rather than just its full path. This can be useful since full path returned from `localePath` might not carry all information from provided input (for example route params that the page doesn't specify).
* `localeRoute` <badge>v6.12+</badge> – Returns the route object for a given page. It works like `localePath` but returns full route resolved by Vue Router rather than just its full path. This can be useful since full path returned from `localePath` might not carry all information from provided input (for example route params that the page doesn't specify).

```vue
<a
Expand Down
Loading

0 comments on commit affb845

Please sign in to comment.