nuxt-i18n
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/paulgv/nuxt-i18n/compare/v1.0.2...v1.1.0) (2018-01-22) | ||
### Features | ||
* Add ignorePaths option ([1a0fc57](https://github.com/paulgv/nuxt-i18n/commit/1a0fc57)) | ||
<a name="1.0.2"></a> | ||
@@ -7,0 +17,0 @@ ## [1.0.2](https://github.com/paulgv/nuxt-i18n/compare/v1.0.1...v1.0.2) (2017-12-07) |
@@ -15,3 +15,4 @@ const { resolve } = require('path') | ||
defaultLocale: options.defaultLocale, | ||
routesOptions: options.routes | ||
routesOptions: options.routes, | ||
ignorePaths: options.ignorePaths | ||
}) | ||
@@ -18,0 +19,0 @@ routes.splice(0, routes.length) |
@@ -11,3 +11,9 @@ const { has } = require('lodash') | ||
*/ | ||
const generateRoutes = ({ baseRoutes, locales, defaultLocale, routesOptions, isChild = false }) => { | ||
const generateRoutes = ({ | ||
baseRoutes, | ||
locales, | ||
defaultLocale, | ||
routesOptions, | ||
ignorePaths = [], | ||
isChild = false }) => { | ||
// Abort routes generation if no routes or locales specified | ||
@@ -18,3 +24,14 @@ if (!baseRoutes || !locales) { | ||
const newRoutes = [] | ||
baseRoutes.forEach((baseRoute) => { | ||
const localizedRoutes = [] | ||
// Extract routes that should not be localized | ||
baseRoutes.forEach(route => { | ||
if (ignorePaths.indexOf(route.path) !== -1) { | ||
newRoutes.push(route) | ||
} else { | ||
localizedRoutes.push(route) | ||
} | ||
}) | ||
localizedRoutes.forEach(baseRoute => { | ||
locales.forEach((locale) => { | ||
@@ -29,2 +46,3 @@ const { component } = baseRoute | ||
routesOptions, | ||
ignorePaths, | ||
isChild: true | ||
@@ -31,0 +49,0 @@ }) |
{ | ||
"name": "nuxt-i18n", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "i18n for Nuxt", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -184,2 +184,3 @@ # nuxt-i18n | ||
| `routes` | Object | Custom routing configuration, if routes are omitted, Nuxt's default routes are used | | ||
| `ignorePaths` | Array | A list of paths that should not be localized | | ||
@@ -236,3 +237,6 @@ | ||
} | ||
} | ||
}, | ||
ignorePaths: [ | ||
'/fr/notlocalized' | ||
] | ||
}] | ||
@@ -239,0 +243,0 @@ ] |
29897
202
250