Skip to content

Commit

Permalink
chore(docs): fix syntax-highlighting of code blocks in ST
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Dec 12, 2020
1 parent 73956e2 commit 1d3afef
Show file tree
Hide file tree
Showing 24 changed files with 105 additions and 192 deletions.
4 changes: 2 additions & 2 deletions docs/content/en/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
'nuxt-i18n'
Expand Down Expand Up @@ -68,7 +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 Down
18 changes: 6 additions & 12 deletions docs/content/en/browser-language-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ category: Guide

By default, **nuxt-i18n** attempts to redirect users to their preferred language by detecting their browser's language. This is controlled by the `detectBrowserLanguage` option:

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: {
Expand All @@ -29,8 +28,7 @@ Browser language is detected either from `navigator` when running on client-side

To prevent redirecting users every time they visit the app, **nuxt-i18n** sets a cookie after the first redirection. You can change the cookie's name by setting `detectBrowserLanguage.cookieKey` option to whatever you'd like, the default is _i18n_redirected_.

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: {
Expand All @@ -42,8 +40,7 @@ To prevent redirecting users every time they visit the app, **nuxt-i18n** sets a

If you'd rather have users be redirected to their browser's language every time they visit the app, disable the cookie by setting `detectBrowserLanguage.useCookie` to `false`.

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: {
Expand All @@ -54,8 +51,7 @@ If you'd rather have users be redirected to their browser's language every time

To completely disable the browser's language detection feature, set `detectBrowserLanguage` to `false`.

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: false
Expand All @@ -64,8 +60,7 @@ To completely disable the browser's language detection feature, set `detectBrows

To redirect the user every time they visit the app and keep their selected choice, enable alwaysRedirect:

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: {
Expand All @@ -77,8 +72,7 @@ To redirect the user every time they visit the app and keep their selected choic

To use the cookie within a cross-origin environment (e.g. in an iFrame), you can set `cookieCrossOrigin: true`. This will change the cookie settings from `SameSite=Lax` to `SameSite=None; Secure`.

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
// ...
detectBrowserLanguage: {
Expand Down
6 changes: 2 additions & 4 deletions docs/content/en/callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ Parameters:

A typical usage would be to define those callbacks via a plugin where you can access the app's context \(useful if you need to change Axios' config when the language changes for example\).

```js{}[/plugins/i18n.js]
```js {}[/plugins/i18n.js]
export default function ({ app }) {
// beforeLanguageSwitch called right before setting a new locale
app.i18n.beforeLanguageSwitch = (oldLocale, newLocale) => {
Expand All @@ -46,8 +45,7 @@ export default function ({ app }) {

Add the plugin to Nuxt's config:

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
module.exports = {
plugins: [
{ src: '~/plugins/i18n.js' }
Expand Down
9 changes: 4 additions & 5 deletions docs/content/en/different-domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ You might want to use a different domain name for each language your app support

</alert>

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
locales: [
{
Expand Down Expand Up @@ -55,14 +54,14 @@ As `nuxt.config.js` is used at build time it would be necessary to create differ
The alternative way is to keep the domains in Vuex store under `localeDomains` property. It can be accessed by the plugin
during the initialisation, saving the trouble building multiple images.

```js{}[config/locale-domains.js]
```js {}[config/locale-domains.js]
module.exports = {
uk: process.env.DOMAIN_UK,
fr: process.env.DOMAIN_FR,
};
```

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
const localeDomains = require('./config/locale-domains')
//...
[
Expand All @@ -83,7 +82,7 @@ const localeDomains = require('./config/locale-domains')
]
```

```js{}[store/index.js]
```js {}[store/index.js]
const localeDomains = require('~~/config/locale-domains');

export const state = () => ({
Expand Down
3 changes: 1 addition & 2 deletions docs/content/en/lang-switcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ computed: {
}
```

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
locales: [
{
Expand Down
6 changes: 2 additions & 4 deletions docs/content/en/lazy-load-translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ nuxt-project/

Configuration example:

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
locales: [
{
Expand All @@ -53,8 +52,7 @@ Configuration example:

Language file example:

```js{}[lang/en-US.js]
```js {}[lang/en-US.js]
export default async (context, locale) => {
await resolve({
welcome: 'Welcome'
Expand Down
29 changes: 10 additions & 19 deletions docs/content/en/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ v4.x introduces a single change that requires you to rename the `i18n` key to `n

**3.x:**

```js{}[pages/about.vue]
```js {}[pages/about.vue]
export default {
i18n: {
paths: {
Expand All @@ -84,8 +83,7 @@ export default {

**4.x:**

```js{}[pages/about.vue]
```js {}[pages/about.vue]
export default {
nuxtI18n: {
paths: {
Expand All @@ -104,8 +102,7 @@ The `routes` option has been dropped in favor of in-component configuration, any

**2.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
['nuxt-i18n', {
Expand All @@ -122,8 +119,7 @@ The `routes` option has been dropped in favor of in-component configuration, any

**3.x:**

```js{}[pages/about.vue]
```js {}[pages/about.vue]
export default {
i18n: {
paths: {
Expand All @@ -141,8 +137,7 @@ The `ignorePaths` option has been dropped as well, its behaviour can be reproduc

**2.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
['nuxt-i18n', {
Expand All @@ -156,8 +151,7 @@ The `ignorePaths` option has been dropped as well, its behaviour can be reproduc

**3.x:**

```js{}[pages/fr/notlocalized.vue]
```js {}[pages/fr/notlocalized.vue]
export default {
i18n: false
}
Expand All @@ -170,8 +164,7 @@ The `noPrefixDefaultLocale` has been dropped in favor of `strategy` option.

**2.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
['nuxt-i18n', {
Expand All @@ -183,7 +176,7 @@ The `noPrefixDefaultLocale` has been dropped in favor of `strategy` option.

**3.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]

{
modules: [
Expand All @@ -204,8 +197,7 @@ The `noPrefixDefaultLocale` has been dropped in favor of `strategy` option.

**2.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
['nuxt-i18n', {
Expand All @@ -219,8 +211,7 @@ The `noPrefixDefaultLocale` has been dropped in favor of `strategy` option.

**3.x:**

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
{
modules: [
['nuxt-i18n', {
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/options-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ category: Guide

You can configure **nuxt-i18n** with the `i18n` property in your `nuxt.config.js` or by passing options inline with the module declaration:

```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
export default {
modules: [
'nuxt-i18n',
Expand Down Expand Up @@ -199,7 +199,7 @@ Configuration for the `vue-i18n` library that is used internally but this module

It's also supported to set this property to a path to a local configuration file. The file needs to export a function or plain object. If a function, it will be passed a Nuxt Context as a parameter. It's necessary to use that approach when overriding more complex types (like functions) that can't be stringified correctly.

```js{}[~/plugins/vue-i18n.js]
```js {}[~/plugins/vue-i18n.js]
export default context => {
return {
modifiers: {
Expand Down
33 changes: 11 additions & 22 deletions docs/content/en/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ This strategy combines both previous strategies behaviours, meaning that you wil
To configure the strategy, use the `strategy` option.
Make sure that you have a `defaultLocale` defined, especially if using **prefix_except_default**, **prefix_and_default** or **no_prefix** strategy. For other strategies it's also recommended to set it as it's gonna be used as a fallback when attempting to redirect from 404 page.
```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
strategy: 'prefix_except_default',
defaultLocale: 'en'
Expand All @@ -90,8 +89,7 @@ If on `Nuxt` version lower than 2.10.2, and using strategy `prefix_except_defaul
</alert>
```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
strategy: 'prefix_except_default',
defaultLocale: 'en',
Expand All @@ -116,8 +114,7 @@ Custom paths are not supported with the `no-prefix` [strategy](#strategy).
Add a `nuxtI18n.paths` property to your page and set your custom paths there:
```js{}[pages/about.vue]
```js {}[pages/about.vue]
export default {
nuxtI18n: {
paths: {
Expand All @@ -131,8 +128,7 @@ export default {
To configure a custom path for a dynamic route, you need to put the params in the URI similarly to how you would do it in vue-router.
```js{}[pages/articles/_name.vue]
```js {}[pages/articles/_name.vue]
export default {
nuxtI18n: {
paths: {
Expand All @@ -147,8 +143,7 @@ export default {
Make sure you set the `parsePages` option to `false` to disable babel parsing and add your custom paths in the `pages` option:
```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
parsePages: false, // Disable babel parsing
pages: {
Expand Down Expand Up @@ -185,8 +180,7 @@ pages/
Here's how you would configure these particular pages in the configuration:
```js{}[nuxt.config.js]
```js {}[nuxt.config.js]
['nuxt-i18n', {
parsePages: false,
pages: {
Expand Down Expand Up @@ -221,8 +215,7 @@ pages/

You would need to set up your `pages` property as follows:

```js{}[nuxt.config.js]

```js {}[nuxt.config.js]
['nuxt-i18n', {
parsePages: false,
pages: {
Expand Down Expand Up @@ -269,8 +262,7 @@ This feature is not supported with the `no-prefix` [strategy](#strategy).

If you'd like some page to be available to some languages only, you can configure a list of supported languages to override global settings:

```js{}[pages/about.vue]

```js {}[pages/about.vue]
export default {
nuxtI18n: {
locales: ['fr', 'es']
Expand All @@ -280,8 +272,7 @@ export default {

To completely disable i18n on a given page:

```js{}[pages/about.vue]

```js {}[pages/about.vue]
export default {
nuxtI18n: false
}
Expand All @@ -291,8 +282,7 @@ export default {

If you disabled `parsePages` option, localization can be disabled for specific pages and locales by setting the unwanted locale(s) to `false` in the module's configuration:

```js{}[nuxt.config.js]

```js {}[nuxt.config.js]
['nuxt-i18n', {
parsePages: false,
pages: {
Expand All @@ -305,8 +295,7 @@ If you disabled `parsePages` option, localization can be disabled for specific p

To completely disable routes localization on a given page:

```js{}[nuxt.config.js]

```js {}[nuxt.config.js]
['nuxt-i18n', {
parsePages: false,
pages: {
Expand Down
Loading

0 comments on commit 1d3afef

Please sign in to comment.