nuxt-i18n
Advanced tools
Comparing version 6.27.3 to 6.28.0
{ | ||
"name": "nuxt-i18n", | ||
"version": "6.27.3", | ||
"version": "6.28.0", | ||
"description": "i18n for Nuxt", | ||
@@ -101,3 +101,3 @@ "license": "MIT", | ||
"ufo": "^0.7.7", | ||
"vue-i18n": "^8.24.5" | ||
"vue-i18n": "^8.25.0" | ||
}, | ||
@@ -109,3 +109,3 @@ "devDependencies": { | ||
"@nuxt/types": "2.15.7", | ||
"@nuxtjs/composition-api": "0.24.6", | ||
"@nuxtjs/composition-api": "0.24.7", | ||
"@nuxtjs/eslint-config-typescript": "6.0.1", | ||
@@ -127,5 +127,5 @@ "@nuxtjs/module-test-utils": "1.6.3", | ||
"babel-eslint": "10.1.0", | ||
"codecov": "3.8.2", | ||
"codecov": "3.8.3", | ||
"core-js": "3.15.2", | ||
"eslint": "7.30.0", | ||
"eslint": "7.31.0", | ||
"express": "4.17.1", | ||
@@ -132,0 +132,0 @@ "husky": "4.3.8", |
@@ -31,2 +31,3 @@ /** | ||
defaultLocaleRouteNameSuffix: 'default', | ||
sortRoutes: true, | ||
strategy: STRATEGY_PREFIX_EXCEPT_DEFAULT, | ||
@@ -33,0 +34,0 @@ lazy: false, |
@@ -1,5 +0,4 @@ | ||
import { withoutTrailingSlash, withTrailingSlash } from 'ufo' | ||
import { STRATEGIES } from './constants' | ||
import { extractComponentOptions } from './components' | ||
import { getPageOptions } from './utils' | ||
import { adjustRouteDefinitionForTrailingSlash, getPageOptions } from './utils' | ||
@@ -28,2 +27,3 @@ /** | ||
routesNameSeparator, | ||
sortRoutes, | ||
strategy, | ||
@@ -154,3 +154,3 @@ trailingSlash | ||
if (path.length) { // Don't replace empty (child) path with a slash! | ||
path = (trailingSlash ? withTrailingSlash(path, true) : withoutTrailingSlash(path, true)) || (isChildWithRelativePath ? '' : '/') | ||
path = adjustRouteDefinitionForTrailingSlash(path, trailingSlash, isChildWithRelativePath) | ||
} | ||
@@ -177,8 +177,10 @@ | ||
try { | ||
// @ts-ignore | ||
const { sortRoutes } = require('@nuxt/utils') | ||
localizedRoutes = sortRoutes(localizedRoutes) | ||
} catch (error) { | ||
// Ignore | ||
if (sortRoutes) { | ||
try { | ||
// @ts-ignore | ||
const { sortRoutes: sortRoutesFn } = require('@nuxt/utils') | ||
localizedRoutes = sortRoutesFn(localizedRoutes) | ||
} catch (error) { | ||
// Ignore | ||
} | ||
} | ||
@@ -185,0 +187,0 @@ |
@@ -56,1 +56,11 @@ /** | ||
} | ||
/** | ||
* @param {string} routePath | ||
* @param {boolean | undefined} trailingSlash | ||
* @param {boolean} [isChildWithRelativePath] Indicates if it is a child route that has relative path | ||
* @return {string} | ||
*/ | ||
export function adjustRouteDefinitionForTrailingSlash (routePath, trailingSlash, isChildWithRelativePath) { | ||
return routePath.replace(/\/+$/, '') + (trailingSlash ? '/' : '') || (isChildWithRelativePath ? '' : '/') | ||
} |
@@ -398,7 +398,9 @@ import Vue from 'vue' | ||
finalLocale = routeLocale | ||
} else if (useCookie) { | ||
finalLocale = app.i18n.getLocaleCookie() | ||
} | ||
} | ||
if (!finalLocale && useCookie) { | ||
finalLocale = app.i18n.getLocaleCookie() | ||
} | ||
if (!finalLocale) { | ||
@@ -405,0 +407,0 @@ finalLocale = app.i18n.defaultLocale || '' |
@@ -76,2 +76,3 @@ import VueI18n, { Locale, I18nOptions, IVueI18n } from 'vue-i18n' | ||
skipSettingLocaleOnNavigate?: boolean, | ||
sortRoutes?: boolean, | ||
strategy?: Strategies | ||
@@ -78,0 +79,0 @@ vueI18n?: I18nOptions | string |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83963
2110
Updatedvue-i18n@^8.25.0