Skip to content

Commit

Permalink
fix: Rename option encodeURI to encodePaths
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgv committed Jan 24, 2019
1 parent 2ce6cf8 commit 776c2dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/options-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Here are all the options available when configuring the module and their default
// This does not work with regexp: "/foo/:slug-:id(\\d+)". If you want to use
// regexp in the path, then set this option to false, and make sure you process
// path encoding yourself.
encodeURI: true,
encodePaths: true,

// Called right before app's locale changes
beforeLanguageSwitch: () => null,
Expand Down
4 changes: 2 additions & 2 deletions docs/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ You would need to set up your `pages` property as follows:
By default, all custom paths are encoded to handle non-latin characters in the path. This will convert paths with regular expression like `/foo/:slug-:id(\\d+)` to `/foo/:slug-:id(%5Cd+)`.
If you would like to use regular expression in your custom paths, then you need to set the `encodeURI` option to false. Since no encoding will happen, you will have to make sure to pass in encoded paths yourself.
If you would like to use regular expression in your custom paths, then you need to set the `encodePaths` option to false. Since no encoding will happen, you will have to make sure to pass in encoded paths yourself.
```js
// nuxt.config.js
['nuxt-i18n', {
encodeURI: false
encodePaths: false
}]
```
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports.DEFAULT_OPTIONS = {
},
parsePages: true,
pages: {},
encodeURI: true,
encodePaths: true,
beforeLanguageSwitch: () => null,
onLanguageSwitched: () => null
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.makeRoutes = (baseRoutes, {
strategy,
parsePages,
pages,
encodeURI,
encodePaths,
pagesDir,
differentDomains
}) => {
Expand Down Expand Up @@ -78,7 +78,7 @@ exports.makeRoutes = (baseRoutes, {

// Get custom path if any
if (componentOptions.paths && componentOptions.paths[locale]) {
path = encodeURI ? encodeURI(componentOptions.paths[locale]) : componentOptions.paths[locale]
path = encodePaths ? encodeURI(componentOptions.paths[locale]) : componentOptions.paths[locale]
}

// Add route prefix if needed
Expand Down

0 comments on commit 776c2dd

Please sign in to comment.