From 1d3afef29bda1ca93b7de84818746d75ea3be7dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ch=C5=82odnicki?= Date: Sat, 12 Dec 2020 23:50:49 +0100 Subject: [PATCH] chore(docs): fix syntax-highlighting of code blocks in ST --- docs/content/en/basic-usage.md | 4 +-- docs/content/en/browser-language-detection.md | 18 ++++------ docs/content/en/callbacks.md | 6 ++-- docs/content/en/different-domains.md | 9 +++-- docs/content/en/lang-switcher.md | 3 +- docs/content/en/lazy-load-translations.md | 6 ++-- docs/content/en/migrating.md | 29 ++++++---------- docs/content/en/options-reference.md | 4 +-- docs/content/en/routing.md | 33 +++++++------------ docs/content/en/seo.md | 30 ++++++----------- docs/content/en/setup.md | 4 +-- docs/content/en/vue-i18n-loader.md | 3 +- docs/content/es/basic-usage.md | 5 ++- docs/content/es/browser-language-detection.md | 18 ++++------ docs/content/es/callbacks.md | 6 ++-- docs/content/es/different-domains.md | 9 +++-- docs/content/es/lang-switcher.md | 3 +- docs/content/es/lazy-load-translations.md | 6 ++-- docs/content/es/migrating.md | 30 ++++++----------- docs/content/es/options-reference.md | 4 +-- docs/content/es/routing.md | 30 ++++++----------- docs/content/es/seo.md | 30 ++++++----------- docs/content/es/setup.md | 4 +-- docs/content/es/vue-i18n-loader.md | 3 +- 24 files changed, 105 insertions(+), 192 deletions(-) diff --git a/docs/content/en/basic-usage.md b/docs/content/en/basic-usage.md index 189d562a8..580eb21ac 100644 --- a/docs/content/en/basic-usage.md +++ b/docs/content/en/basic-usage.md @@ -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' @@ -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') diff --git a/docs/content/en/browser-language-detection.md b/docs/content/en/browser-language-detection.md index 3ba666bd6..60d6959ba 100644 --- a/docs/content/en/browser-language-detection.md +++ b/docs/content/en/browser-language-detection.md @@ -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: { @@ -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: { @@ -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: { @@ -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 @@ -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: { @@ -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: { diff --git a/docs/content/en/callbacks.md b/docs/content/en/callbacks.md index 64a60c035..3e84b15af 100644 --- a/docs/content/en/callbacks.md +++ b/docs/content/en/callbacks.md @@ -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) => { @@ -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' } diff --git a/docs/content/en/different-domains.md b/docs/content/en/different-domains.md index a9e1ef5a0..4386bb699 100644 --- a/docs/content/en/different-domains.md +++ b/docs/content/en/different-domains.md @@ -13,8 +13,7 @@ You might want to use a different domain name for each language your app support -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -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') //... [ @@ -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 = () => ({ diff --git a/docs/content/en/lang-switcher.md b/docs/content/en/lang-switcher.md index 736ce1245..0602357bb 100644 --- a/docs/content/en/lang-switcher.md +++ b/docs/content/en/lang-switcher.md @@ -24,8 +24,7 @@ computed: { } ``` -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { diff --git a/docs/content/en/lazy-load-translations.md b/docs/content/en/lazy-load-translations.md index 1d5416b03..c1cd19fd7 100755 --- a/docs/content/en/lazy-load-translations.md +++ b/docs/content/en/lazy-load-translations.md @@ -28,8 +28,7 @@ nuxt-project/ Configuration example: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -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' diff --git a/docs/content/en/migrating.md b/docs/content/en/migrating.md index a57e7a06e..cb98ad43c 100644 --- a/docs/content/en/migrating.md +++ b/docs/content/en/migrating.md @@ -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: { @@ -84,8 +83,7 @@ export default { **4.x:** -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { paths: { @@ -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', { @@ -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: { @@ -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', { @@ -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 } @@ -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', { @@ -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: [ @@ -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', { @@ -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', { diff --git a/docs/content/en/options-reference.md b/docs/content/en/options-reference.md index c3a2bc119..a19eecbcc 100644 --- a/docs/content/en/options-reference.md +++ b/docs/content/en/options-reference.md @@ -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', @@ -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: { diff --git a/docs/content/en/routing.md b/docs/content/en/routing.md index f6264b815..fdfd5b0bb 100644 --- a/docs/content/en/routing.md +++ b/docs/content/en/routing.md @@ -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' @@ -90,8 +89,7 @@ If on `Nuxt` version lower than 2.10.2, and using strategy `prefix_except_defaul -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { strategy: 'prefix_except_default', defaultLocale: 'en', @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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'] @@ -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 } @@ -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: { @@ -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: { diff --git a/docs/content/en/seo.md b/docs/content/en/seo.md index 7b6b9c4e7..46301633a 100644 --- a/docs/content/en/seo.md +++ b/docs/content/en/seo.md @@ -27,8 +27,7 @@ When the `seo` option is enabled, **nuxt-i18n** attempts to add some metadata to An example without selected catchall locale: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -45,8 +44,7 @@ An example without selected catchall locale: Here is how you'd use `isCatchallLocale` to selected another language: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -64,8 +62,7 @@ Here is how you'd use `isCatchallLocale` to selected another language: In case you already have an `en` language iso set, it'll be used as the catchall without doing anything -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -96,8 +93,7 @@ Generates `rel="canonical"` link on all pages to specify the "main" version of t To leverage the SEO benefits, you must configure the `locales` option as an array of objects, where each object has an `iso` option set to the language's ISO code: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -118,8 +114,7 @@ To leverage the SEO benefits, you must configure the `locales` option as an arra You must also set the `baseUrl` option to your production domain in order to make alternate URLs fully-qualified: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { baseUrl: 'https://my-nuxt-app.com' }] @@ -130,8 +125,7 @@ You must also set the `baseUrl` option to your production domain in order to mak To enable this feature everywhere in your app, set `seo` option to `true`. **This comes with a performance drawback though**. More information below. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { seo: true }] @@ -139,8 +133,7 @@ To enable this feature everywhere in your app, set `seo` option to `true`. If you'd like to disable SEO on specific pages, set `i18n.seo` to `false` right in the page: -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { seo: false @@ -161,8 +154,7 @@ It will generate i18n SEO metadata for the current context. First make sure automatic SEO is disabled by setting `seo` to `false` in your configuration or removing that option completely: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { seo: false }] @@ -170,8 +162,7 @@ First make sure automatic SEO is disabled by setting `seo` to `false` in your co Then in your app layout declare the [`head` hook](https://nuxtjs.org/guides/features/meta-tags-seo) and use `$nuxtI18nSeo` inside to generate i18n SEO meta information: -```js{}[layouts/default.vue] - +```js {}[layouts/default.vue] export default { head () { return this.$nuxtI18nSeo() @@ -188,8 +179,7 @@ Now SEO metadata will only be computed for the layout instead of every component If you want to add your own meta in the layout you can easily merge the object returned by `$nuxtI18nSeo` with your own: -```js{}[layouts/default.vue] - +```js {}[layouts/default.vue] export default { head () { const i18nSeo = this.$nuxtI18nSeo() diff --git a/docs/content/en/setup.md b/docs/content/en/setup.md index 2d5dbbf21..38543187d 100644 --- a/docs/content/en/setup.md +++ b/docs/content/en/setup.md @@ -32,7 +32,7 @@ Add `nuxt-i18n` dependency to your project: Then, add `nuxt-i18n` to the `modules` section of `nuxt.config.js`: -```js{}[nuxt.config.js] +```js {}[nuxt.config.js] { modules: [ 'nuxt-i18n', @@ -47,7 +47,7 @@ Then, add `nuxt-i18n` to the `modules` section of `nuxt.config.js`: If using typescript or running typescript language server to check the code (for example through Vetur), add types to `types` array in your `tsconfig.json`: -```js{}[tsconfig.json] +```js {}[tsconfig.json] { "compilerOptions": { "types": [ diff --git a/docs/content/en/vue-i18n-loader.md b/docs/content/en/vue-i18n-loader.md index a7f334e4d..a8f458654 100644 --- a/docs/content/en/vue-i18n-loader.md +++ b/docs/content/en/vue-i18n-loader.md @@ -7,8 +7,7 @@ category: Guide If you'd like to enable [vue-i18n-loader](https://github.com/intlify/vue-i18n-loader), simply set `vueI18nLoader` option to `true`. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { vueI18nLoader: true }] diff --git a/docs/content/es/basic-usage.md b/docs/content/es/basic-usage.md index 1910882f1..3ec21729b 100644 --- a/docs/content/es/basic-usage.md +++ b/docs/content/es/basic-usage.md @@ -7,7 +7,7 @@ category: Guía La forma más rápida de comenzar con **nuxt-i18n** es definir la lista de entornos `locales` admitidos y proporcionar algunos mensajes de traducción a **vue-i18n** a través de la opción `vueI18n`: -```js{}[nuxt.config.js] +```js {}[nuxt.config.js] { modules: [ 'nuxt-i18n' @@ -69,8 +69,7 @@ Tenga en cuenta que `localePath` utiliza el nombre base de la ruta para generar Por conveniencia, estos métodos también están disponibles en el contexto de la aplicación: -```js{}[/plugins/myplugin.js] - +```js {}[/plugins/myplugin.js] export default ({ app }) => { // Get localized path for homepage const localePath = app.localePath('index') diff --git a/docs/content/es/browser-language-detection.md b/docs/content/es/browser-language-detection.md index d8f7ebf1f..bb70d8bad 100644 --- a/docs/content/es/browser-language-detection.md +++ b/docs/content/es/browser-language-detection.md @@ -8,8 +8,7 @@ category: Guía Por defecto, **nuxt-i18n** intenta redirigir a los usuarios a su idioma preferido al detectar el idioma de su navegador. Esto está controlado por la opción `detectBrowserLanguage`: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { // ... detectBrowserLanguage: { @@ -30,8 +29,7 @@ Browser language is detected either from `navigator` when running on client-side Para evitar redirigir a los usuarios cada vez que visitan la aplicación, **nuxt-i18n** establece una cookie después de la primera redirección. Puede cambiar el nombre de la cookie configurando la opción `detectBrowserLanguage.cookieKey` a lo que desee, el valor predeterminado es _i18n_redirected_. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { detectBrowserLanguage: { useCookie: true, @@ -42,8 +40,7 @@ Para evitar redirigir a los usuarios cada vez que visitan la aplicación, **nuxt Si prefiere que los usuarios sean redirigidos al idioma de su navegador cada vez que visitan la aplicación, deshabilite la cookie configurando `detectBrowserLanguage.useCookie` en `false`. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { detectBrowserLanguage: { useCookie: false @@ -53,8 +50,7 @@ Si prefiere que los usuarios sean redirigidos al idioma de su navegador cada vez Para deshabilitar por completo la función de detección de idioma del navegador, configure `detectBrowserLanguage` en `false`. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { detectBrowserLanguage: false }] @@ -62,8 +58,7 @@ Para deshabilitar por completo la función de detección de idioma del navegador Para redirigir al usuario cada vez que visita la aplicación y mantener su elección seleccionada, habilite alwaysRedirect: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { detectBrowserLanguage: { useCookie: true, @@ -74,8 +69,7 @@ Para redirigir al usuario cada vez que visita la aplicación y mantener su elecc 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: { diff --git a/docs/content/es/callbacks.md b/docs/content/es/callbacks.md index abb66e123..da4aebcb6 100644 --- a/docs/content/es/callbacks.md +++ b/docs/content/es/callbacks.md @@ -31,8 +31,7 @@ Parámetros: Un uso típico sería definir esas devoluciones de llamada a través de un complemento donde puede acceder al contexto de la aplicación \(útil si necesita cambiar la configuración de Axios cuando el idioma cambia, por ejemplo\). -```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) => { @@ -47,8 +46,7 @@ export default function ({ app }) { Agregue el plugin a la configuración de Nuxt: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] module.exports = { plugins: [ { src: '~/plugins/i18n.js' } diff --git a/docs/content/es/different-domains.md b/docs/content/es/different-domains.md index 926f0c485..d604f543a 100644 --- a/docs/content/es/different-domains.md +++ b/docs/content/es/different-domains.md @@ -11,8 +11,7 @@ Es posible que desee utilizar un nombre de dominio diferente para cada idioma qu * Configure `locales` option as an array of objects, where each object has a `domain` key which value is the domain name you'd like to use for that locale (including port if non-default) * Optionally set `detectBrowserLanguage` to `false`. When enabled (which it is by default), user can get redirected to a different domain on first visit. Set to `false` if you want to ensure that visiting given domain always shows page in the corresponding locale. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -53,14 +52,14 @@ Como `nuxt.config.js` se usa en el momento de la compilación, sería necesario La forma alternativa es mantener los dominios en la tienda Vuex bajo la propiedad `localeDomains`. Se puede acceder mediante el complemento durante la inicialización, ahorrando el problema de construir múltiples imágenes. -```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') //... [ @@ -81,7 +80,7 @@ const localeDomains = require('./config/locale-domains') ] ``` -```js{}[store/index.js] +```js {}[store/index.js] const localeDomains = require('~~/config/locale-domains'); export const state = () => ({ diff --git a/docs/content/es/lang-switcher.md b/docs/content/es/lang-switcher.md index 4197aec50..9de3fe996 100644 --- a/docs/content/es/lang-switcher.md +++ b/docs/content/es/lang-switcher.md @@ -23,8 +23,7 @@ computed: { } ``` -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { diff --git a/docs/content/es/lazy-load-translations.md b/docs/content/es/lazy-load-translations.md index 8ab8f6da8..03df6bd42 100644 --- a/docs/content/es/lazy-load-translations.md +++ b/docs/content/es/lazy-load-translations.md @@ -28,8 +28,7 @@ nuxt-project/ Ejemplo de configuración: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -53,8 +52,7 @@ Ejemplo de configuración: Ejemplo de archivo de idioma: -```js{}[lang/en-US.js] - +```js {}[lang/en-US.js] export default async (context, locale) => { await resolve({ welcome: 'Welcome' diff --git a/docs/content/es/migrating.md b/docs/content/es/migrating.md index 84ec5f264..2f7002d55 100644 --- a/docs/content/es/migrating.md +++ b/docs/content/es/migrating.md @@ -70,8 +70,7 @@ v4.x introduce un solo cambio que requiere que cambie el nombre de la clave `i18 **3.x:** -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { i18n: { paths: { @@ -84,8 +83,7 @@ export default { **4.x:** -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { paths: { @@ -104,8 +102,7 @@ La opción `routes` se ha descartado a favor de la configuración en componentes **2.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { @@ -122,8 +119,7 @@ La opción `routes` se ha descartado a favor de la configuración en componentes **3.x:** -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { i18n: { paths: { @@ -141,8 +137,7 @@ La opción `ignorePaths` también se ha eliminado, su comportamiento se puede re **2.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { @@ -156,8 +151,7 @@ La opción `ignorePaths` también se ha eliminado, su comportamiento se puede re **3.x:** -```js{}[pages/fr/notlocalized.vue] - +```js {}[pages/fr/notlocalized.vue] export default { i18n: false } @@ -170,8 +164,7 @@ El `noPrefixDefaultLocale` se ha descartado en favor de la opción `strategy`. **2.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { @@ -183,8 +176,7 @@ El `noPrefixDefaultLocale` se ha descartado en favor de la opción `strategy`. **3.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { @@ -204,8 +196,7 @@ La opción `loadLanguagesAsync` ha cambiado de nombre a `lazy`. La opción `lan **2.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { @@ -219,8 +210,7 @@ La opción `loadLanguagesAsync` ha cambiado de nombre a `lazy`. La opción `lan **3.x:** -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] { modules: [ ['nuxt-i18n', { diff --git a/docs/content/es/options-reference.md b/docs/content/es/options-reference.md index cffadbb13..640796687 100644 --- a/docs/content/es/options-reference.md +++ b/docs/content/es/options-reference.md @@ -7,7 +7,7 @@ category: Guía 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', @@ -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: { diff --git a/docs/content/es/routing.md b/docs/content/es/routing.md index 563f0a930..b198c854d 100644 --- a/docs/content/es/routing.md +++ b/docs/content/es/routing.md @@ -73,8 +73,7 @@ Esta estrategia combina los comportamientos de ambas estrategias anteriores, lo Para configurar la estrategia, use la opción `strategy`. 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' @@ -96,8 +95,7 @@ Custom paths are not supported with the `no-prefix` [strategy](#strategy). Agregue una propiedad `nuxtI18n.paths` a su página y configure sus rutas personalizadas allí: -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { paths: { @@ -111,8 +109,7 @@ export default { Para configurar una ruta personalizada para una ruta dinámica, debe colocar los parámetros en el URI de forma similar a como lo haría en vue-router. -```js{}[pages/articles/_name.vue] - +```js {}[pages/articles/_name.vue] export default { nuxtI18n: { paths: { @@ -127,8 +124,7 @@ export default { Asegúrese de establecer la opción `parsePages` en `false` para deshabilitar el análisis de babel y agregar sus rutas personalizadas en la opción `pages`: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { parsePages: false, // Disable babel parsing pages: { @@ -165,8 +161,7 @@ pages/ Así es como configuraría estas páginas en particular en la configuración: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { parsePages: false, pages: { @@ -201,8 +196,7 @@ pages/ Debería configurar su propiedad `pages` de la siguiente manera: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { parsePages: false, pages: { @@ -249,8 +243,7 @@ This feature is not supported with the `no-prefix` [strategy](#strategy). Si desea que alguna página esté disponible solo para algunos idiomas, puede configurar una lista de idiomas compatibles para anular la configuración global: -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { locales: ['fr', 'es'] @@ -260,8 +253,7 @@ export default { Para deshabilitar completamente i18n en una página determinada: -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: false } @@ -271,8 +263,7 @@ export default { Si deshabilitó la opción `parsePages`, la localización puede deshabilitarse para páginas y configuraciones locales específicas configurando las configuraciones locales no deseadas en `false` en la configuración del módulo: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { parsePages: false, pages: { @@ -285,8 +276,7 @@ Si deshabilitó la opción `parsePages`, la localización puede deshabilitarse p Para deshabilitar completamente la localización de rutas en una página determinada: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { parsePages: false, pages: { diff --git a/docs/content/es/seo.md b/docs/content/es/seo.md index 9cfdde72c..1d71f9b48 100644 --- a/docs/content/es/seo.md +++ b/docs/content/es/seo.md @@ -27,8 +27,7 @@ When the `seo` option is enabled, **nuxt-i18n** attempts to add some metadata to An example without selected catchall locale: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -45,8 +44,7 @@ An example without selected catchall locale: Here is how you'd use `isCatchallLocale` to selected another language: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -64,8 +62,7 @@ Here is how you'd use `isCatchallLocale` to selected another language: In case you already have an `en` language iso set, it'll be used as the catchall without doing anything -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -96,8 +93,7 @@ Generates `rel="canonical"` link on all pages to specify the "main" version of t Para que esta característica funcione, debe configurar la opción `locales` como una matriz de objetos, donde cada objeto tiene una opción `iso` establecida en el código ISO del idioma: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { locales: [ { @@ -118,8 +114,7 @@ Para que esta característica funcione, debe configurar la opción `locales` com También debe establecer la opción `baseUrl` en su dominio de producción para que las URL alternativas sean totalmente calificadas: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { baseUrl: 'https://my-nuxt-app.com' }] @@ -129,8 +124,7 @@ También debe establecer la opción `baseUrl` en su dominio de producción para Para habilitar esta función en todas partes en su aplicación, configure la opción `seo` en `true`: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { seo: true }] @@ -138,8 +132,7 @@ Para habilitar esta función en todas partes en su aplicación, configure la opc Si desea deshabilitar el SEO en páginas específicas, configure `i18n.seo` en `false` justo en la página: -```js{}[pages/about.vue] - +```js {}[pages/about.vue] export default { nuxtI18n: { seo: false @@ -159,8 +152,7 @@ Para mejorar el rendimiento, puede utilizar el método `$nuxtI18nSeo` en su dise Primero, asegúrese de que el SEO automático esté desactivado estableciendo `seo` en `false` en su configuración o eliminando esa opción por completo: -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { seo: false }] @@ -168,8 +160,7 @@ Primero, asegúrese de que el SEO automático esté desactivado estableciendo `s Luego, en el diseño de su aplicación, declare el [`head` hook](https://nuxtjs.org/guides/features/meta-tags-seo) y use `$nuxtI18nSeo` dentro para generar la metainformación i18n SEO: -```js{}[layouts/default.vue] - +```js {}[layouts/default.vue] export default { head () { return this.$nuxtI18nSeo() @@ -185,8 +176,7 @@ Si tiene más diseños, no olvide agregarlo allí también. Si desea agregar su propio meta en el diseño, puede combinar fácilmente el objeto devuelto por `$nuxtI18nSeo` con el suyo: -```js{}[layouts/default.vue] - +```js {}[layouts/default.vue] export default { head () { const i18nSeo = this.$nuxtI18nSeo() diff --git a/docs/content/es/setup.md b/docs/content/es/setup.md index 82e925582..c0080158a 100644 --- a/docs/content/es/setup.md +++ b/docs/content/es/setup.md @@ -32,7 +32,7 @@ Agregar `nuxt-i18n` a tus dependencias: Luego añadir `nuxt-i18n` a la `modules` seccíon de `nuxt.config.js`: -```js{}[nuxt.config.js] +```js {}[nuxt.config.js] { modules: [ 'nuxt-i18n', @@ -47,7 +47,7 @@ Luego añadir `nuxt-i18n` a la `modules` seccíon de `nuxt.config.js`: Si está utilizando typescript o ejecuta un servidor de lenguaje de typescript para verificar el código (por ejemplo, a través de Vetur), agregue tipos a la matriz `types` en su `tsconfig.json`: -```js{}[tsconfig.json] +```js {}[tsconfig.json] { "compilerOptions": { "types": [ diff --git a/docs/content/es/vue-i18n-loader.md b/docs/content/es/vue-i18n-loader.md index 2a3ad25f1..3cac5c2d6 100644 --- a/docs/content/es/vue-i18n-loader.md +++ b/docs/content/es/vue-i18n-loader.md @@ -7,8 +7,7 @@ category: Guía Si desea habilitar [vue-i18n-loader](https://github.com/intlify/vue-i18n-loader), simplemente configure la opción `vueI18nLoader` en `true`. -```js{}[nuxt.config.js] - +```js {}[nuxt.config.js] ['nuxt-i18n', { vueI18nLoader: true }]