Skip to content

Commit

Permalink
Merge pull request #102 from tuqire/master
Browse files Browse the repository at this point in the history
fix: support locales with names that match other locales (`en` and `en-us`)
  • Loading branch information
paulgv authored Jun 27, 2018
2 parents 75300c3 + eeda1c5 commit 513cbf9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/plugins/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,12 @@ function getRouteBaseNameFactory (contextRoute) {
}

return function getRouteBaseName (route) {
const LOCALE_CODE_KEY = '<%= options.LOCALE_CODE_KEY %>'
const getLocaleCodes = <%= options.getLocaleCodes %>
const routesNameSeparator = '<%= options.routesNameSeparator %>'
route = routeGetter.call(this, route)
if (!route.name) {
return null
}
const locales = getLocaleCodes(<%= JSON.stringify(options.locales) %>)
const regexp = new RegExp(routesNameSeparator + '(' + locales.join('|') + ')')
return route.name.replace(regexp, '')
return route.name.split(routesNameSeparator)[0]
}
}

Expand Down

0 comments on commit 513cbf9

Please sign in to comment.