Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Jan 6, 2021
1 parent 36fa132 commit 89a2301
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
4 changes: 4 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ const config = {
text: 'ESLint Plugin',
link: 'https://intlify.github.io/eslint-plugin-vue-i18n/'
},
{
text: 'CLI Tooling',
link: 'https://github.com/intlify/cli',
},
{
text: 'Extensions',
link: 'https://github.com/kazupon/vue-i18n-extensions'
Expand Down
14 changes: 8 additions & 6 deletions docs/advanced/optimization.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Optimization


## Pre translations with extensions

You can pre-translation with vue-i18n-extensions.

About how to usage, see [here](https://github.com/intlify/vue-i18n-extensions).

## Improve performance and reduce bundle size with runtime build only

As described in "[installation](installation##from-cdn-or-without-a-bundler)" section, Vue I18n offer the following two built ES modules for Bundler.
Expand Down Expand Up @@ -69,6 +63,7 @@ In vite, use `alias` option as below:

```js
import path from 'path'
import vue from '@vitejs/plugin-vue'
import { pluginI18n } from '@intlify/vite-plugin-vue-i18n'

import type { UserConfig } from 'vite'
Expand All @@ -79,6 +74,7 @@ const config: UserConfig = {
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
},
plugins: [
vue(),
pluginI18n({
include: path.resolve(__dirname, './path/to/src/locales/**')
})
Expand Down Expand Up @@ -106,3 +102,9 @@ The build will work without configuring these flags, however it is **strongly re
:::tip NOTE
The replacement value **must be boolean literals** and cannot be strings, otherwise the bundler/minifier will not be able to properly evaluate the conditions.
:::

## Pre translations with extensions

You can pre-translation with vue-i18n-extensions.

About how to usage, see [here](https://github.com/intlify/vue-i18n-extensions).
14 changes: 9 additions & 5 deletions docs/advanced/sfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To use i18n custom blocks, you need to use the following plugins for bundler.

[vue-i18n-loader](https://github.com/intlify/vue-i18n-loader) is loader plugin for [webpack](https://webpack.js.org/). Since single file components is bundled with [vue-loader](https://github.com/vuejs/vue-loader), you need to setting webpack config with vue-i18n-loader.

:::tip NOTE
:::tip REQUIREMENTS
- webpack: **v4 or later**
- vue-loader: **v16 or later**.
:::
Expand Down Expand Up @@ -107,7 +107,7 @@ module.exports = {

[rollup-plugin-vue-i18n](https://github.com/intlify/rollup-plugin-vue-i18n) is rollup plugin for [rollup](https://rollupjs.org). Since single-file components is bundled with [rollup-plugin-vue](https://github.com/vuejs/rollup-plugin-vue), you need to setting rollup config with rollup-plugin-vue

:::tip NOTE
:::tip REQUIREMENTS
- rollup: **v2.32 or later**
- rollup-plugin-vue: **v6 or later**.
:::
Expand Down Expand Up @@ -157,8 +157,9 @@ export default [

[vite-plugin-vue-i18n](https://github.com/intlify/vite-plugin-vue-i18n) is vite plugin for [Vite](https://github.com/vitejs/vite).

:::tip NOTE
- vite: **v1 or later**.
:::tip REQUIREMENTS
- vite: **v2-beta or later**.
- @vitejs/plugin-vue: **v1.0.4 or later**.
:::

#### Installation
Expand All @@ -173,19 +174,22 @@ vite config for example:

```ts
import path from 'path'
import vue from '@vitejs/plugin-vue'
import { pluginI18n } from '@intlify/vite-plugin-vue-i18n'

import type { UserConfig } from 'vite'

const config: UserConfig = {
plugins: [
vue(),
pluginI18n({
include: path.resolve(__dirname, './path/to/src/locales/**')
include: path.resolve(__dirname, './locales/**')
})
]
}

export default config

```

## Define locale lessages importing
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script src="https://unpkg.com/vue-i18n@next"></script>
```

You can also use a specific version/tag via URLs like <https://unpkg.com/vue-i18n@9.0.0-beta.8/dist/vue-i18n.global.js>
You can also use a specific version/tag via URLs like <https://unpkg.com/vue-i18n@9.0.0-beta.18/dist/vue-i18n.global.js>

### ES Modules import

Expand All @@ -28,7 +28,7 @@ You can also use a specific version/tag via URLs like <https://unpkg.com/vue-i18
<script type="module" src="https://unpkg.com/vue-i18n@next/dist/vue-i18n.esm-browser.js">
```
You can also use a specific version/tag via URLs like <https://unpkg.com/vue-i18n@9.0.0-beta.8/dist/vue-i18n.esm-browser.js>
You can also use a specific version/tag via URLs like <https://unpkg.com/vue-i18n@9.0.0-beta.18/dist/vue-i18n.esm-browser.js>
## Package managers
Expand Down
2 changes: 1 addition & 1 deletion docs/migration/breaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ console.log(VueI18n.availability)

### Remove Custom formatter

TODO:
**Reason**: Due to hard to provide custom formats in the new compiler and runtime APIs. We are planning to support it in the next major version to support in these APIs. if you would like to use ICU message format, you can use the [@formatjs/vue-intl](https://formatjs.io/docs/vue-intl/)

### Remove `preserveDirectiveContent` option

Expand Down
7 changes: 6 additions & 1 deletion docs/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,18 @@ Still not supported.

It easily integrates some localization lint features to your Vue.js Application.

### Intlify CLI

[@intlify/cli](https://github.com/intlify/cli) is CLI Tooling for i18n development.

You can pre-compile i18n resources (`json5?`, `ya?ml`) with `intlify compile` command.

### Extensions

[vue-i18n-extensions](https://github.com/intlify/vue-i18n-extensions) provides some extensions for Vue I18n.

You can use this extension to enable SSR and improve i18n performance.


## Third-party tooling

### BabelEdit
Expand Down

0 comments on commit 89a2301

Please sign in to comment.