vue-i18n-routing
Advanced tools
Comparing version 1.1.4 to 1.2.0
@@ -7,2 +7,3 @@ import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
import type { Locale } from '@intlify/vue-i18n-bridge'; | ||
import type { Locale as Locale_2 } from 'vue-i18n'; | ||
import { Location as Location_2 } from '@intlify/vue-router-bridge'; | ||
@@ -152,2 +153,4 @@ import { RawLocation } from '@intlify/vue-router-bridge'; | ||
declare type DynamicParamsInterceptor = () => Ref<Record<Locale_2, unknown>>; | ||
export declare type ExtendComposerHook = (compser: Composer) => void; | ||
@@ -292,2 +295,3 @@ | ||
localeCodes?: string[]; | ||
dynamicParamsInterceptor?: DynamicParamsInterceptor; | ||
}; | ||
@@ -616,2 +620,4 @@ | ||
export declare type MetaDynamicParamsInterceptor = (route: Route | RouteLocationNormalizedLoaded, key: Required<I18nRoutingOptions>['dynamicRouteParamsKey']) => Record<Locale, unknown>; | ||
/** | ||
@@ -618,0 +624,0 @@ * Route path prefix judgment logic in {@link resolveRoute} function |
@@ -657,3 +657,4 @@ var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
switchLocalePathIntercepter: proxy.switchLocalePathIntercepter || options.switchLocalePathIntercepter || switchLocalePathIntercepter, | ||
dynamicRouteParamsKey: proxy.dynamicRouteParamsKey || options.dynamicRouteParamsKey || dynamicRouteParamsKey | ||
dynamicRouteParamsKey: proxy.dynamicRouteParamsKey || options.dynamicRouteParamsKey || dynamicRouteParamsKey, | ||
dynamicParamsInterceptor: options.dynamicParamsInterceptor || void 0 | ||
}; | ||
@@ -828,2 +829,3 @@ } | ||
function switchLocalePath(locale) { | ||
var _a, _b; | ||
const route = this.route; | ||
@@ -834,6 +836,11 @@ const name = getRouteBaseName.call(this, route); | ||
} | ||
const { switchLocalePathIntercepter, dynamicRouteParamsKey } = getI18nRoutingOptions(this.router, this); | ||
const { switchLocalePathIntercepter, dynamicRouteParamsKey, dynamicParamsInterceptor } = getI18nRoutingOptions( | ||
this.router, | ||
this | ||
); | ||
const routeValue = vueDemi.isVue3 ? route : vueDemi.isRef(route) ? route.value : route; | ||
const routeCopy = routeToObject(routeValue); | ||
const langSwitchParamsIntercepted = (_b = (_a = dynamicParamsInterceptor == null ? void 0 : dynamicParamsInterceptor()) == null ? void 0 : _a.value) == null ? void 0 : _b[locale]; | ||
const langSwitchParams = getLocalizableMetaFromDynamicParams(route, dynamicRouteParamsKey)[locale] || {}; | ||
const resolvedParams = langSwitchParamsIntercepted ?? langSwitchParams ?? {}; | ||
const _baseRoute = { | ||
@@ -843,3 +850,3 @@ name, | ||
...routeCopy.params, | ||
...langSwitchParams | ||
...resolvedParams | ||
} | ||
@@ -1201,3 +1208,3 @@ }; | ||
} | ||
const VERSION = "1.1.4"; | ||
const VERSION = "1.2.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1204,0 +1211,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -660,3 +660,4 @@ "use strict"; | ||
switchLocalePathIntercepter: proxy.switchLocalePathIntercepter || options.switchLocalePathIntercepter || switchLocalePathIntercepter, | ||
dynamicRouteParamsKey: proxy.dynamicRouteParamsKey || options.dynamicRouteParamsKey || dynamicRouteParamsKey | ||
dynamicRouteParamsKey: proxy.dynamicRouteParamsKey || options.dynamicRouteParamsKey || dynamicRouteParamsKey, | ||
dynamicParamsInterceptor: options.dynamicParamsInterceptor || void 0 | ||
}; | ||
@@ -831,2 +832,3 @@ } | ||
function switchLocalePath(locale) { | ||
var _a, _b; | ||
const route = this.route; | ||
@@ -837,6 +839,11 @@ const name = getRouteBaseName.call(this, route); | ||
} | ||
const { switchLocalePathIntercepter, dynamicRouteParamsKey } = getI18nRoutingOptions(this.router, this); | ||
const { switchLocalePathIntercepter, dynamicRouteParamsKey, dynamicParamsInterceptor } = getI18nRoutingOptions( | ||
this.router, | ||
this | ||
); | ||
const routeValue = vueDemi.isVue3 ? route : vueDemi.isRef(route) ? route.value : route; | ||
const routeCopy = routeToObject(routeValue); | ||
const langSwitchParamsIntercepted = (_b = (_a = dynamicParamsInterceptor == null ? void 0 : dynamicParamsInterceptor()) == null ? void 0 : _a.value) == null ? void 0 : _b[locale]; | ||
const langSwitchParams = getLocalizableMetaFromDynamicParams(route, dynamicRouteParamsKey)[locale] || {}; | ||
const resolvedParams = langSwitchParamsIntercepted ?? langSwitchParams ?? {}; | ||
const _baseRoute = { | ||
@@ -846,3 +853,3 @@ name, | ||
...routeCopy.params, | ||
...langSwitchParams | ||
...resolvedParams | ||
} | ||
@@ -1204,3 +1211,3 @@ }; | ||
} | ||
const VERSION = "1.1.4"; | ||
const VERSION = "1.2.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1207,0 +1214,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"scripts": { | ||
@@ -18,6 +18,6 @@ "dev": "vite", | ||
"@intlify/shared": "^9.4.1", | ||
"@intlify/vue-i18n-bridge": "^1.0.1", | ||
"@intlify/vue-router-bridge": "^1.0.1", | ||
"@intlify/vue-i18n-bridge": "^1.1.0", | ||
"@intlify/vue-router-bridge": "^1.1.0", | ||
"ufo": "^1.2.0", | ||
"vue-demi": "^0.14.5" | ||
"vue-demi": ">=0.13.5 < 1.0.0" | ||
}, | ||
@@ -41,7 +41,7 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"@vue/composition-api": "^1.0.0-rc.1", | ||
"vue": "^2.6.14 || ^2.7.0 || ^3.2.0", | ||
"vue-i18n": "^8.26.1 || >=9.2.0", | ||
"vue-i18n-bridge": ">=9.2.0", | ||
"vue-router": "^3.5.3 || ^3.6.0 || ^4.0.0", | ||
"@vue/composition-api": "^1.0.0-rc.1" | ||
"vue-router": "^3.5.3 || ^3.6.0 || ^4.0.0" | ||
}, | ||
@@ -48,0 +48,0 @@ "peerDependenciesMeta": { |
Sorry, the diff of this file is not supported yet
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
171222
4745
+ Addedmagic-string@0.30.15(transitive)
- Removedmagic-string@0.30.17(transitive)
Updatedvue-demi@>=0.13.5 < 1.0.0