vue-i18n-routing
Advanced tools
Comparing version
@@ -129,3 +129,3 @@ import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
export declare function extendI18n<TI18n extends I18n>(i18n: TI18n, { locales, localeCodes, baseUrl, hooks, context }?: VueI18nExtendOptions): EffectScope; | ||
export declare function extendI18n<Context = unknown, TI18n extends I18n = I18n>(i18n: TI18n, { locales, localeCodes, baseUrl, hooks, context }?: VueI18nExtendOptions<Context>): EffectScope; | ||
@@ -684,6 +684,6 @@ export declare interface ExtendProperyDescripters { | ||
export declare type VueI18nExtendOptions = Pick<I18nRoutingOptions, 'baseUrl'> & { | ||
export declare type VueI18nExtendOptions<Context = unknown> = Pick<I18nRoutingOptions<Context>, 'baseUrl'> & { | ||
locales?: string[] | LocaleObject[]; | ||
localeCodes?: string[]; | ||
context?: unknown; | ||
context?: Context; | ||
hooks?: ExtendHooks; | ||
@@ -690,0 +690,0 @@ }; |
@@ -324,3 +324,9 @@ var VueI18nRouting = function(exports, vueDemi, VueRouter3, vueI18nBridge) { | ||
} | ||
function extendI18n(i18n, { locales = [], localeCodes = [], baseUrl = DEFAULT_BASE_URL, hooks = {}, context = {} } = {}) { | ||
function extendI18n(i18n, { | ||
locales = [], | ||
localeCodes = [], | ||
baseUrl = DEFAULT_BASE_URL, | ||
hooks = {}, | ||
context = {} | ||
} = {}) { | ||
const scope = vueDemi.effectScope(); | ||
@@ -474,3 +480,2 @@ const orgInstall = i18n.install; | ||
const getLocaleFromRoute = createLocaleFromRouteGetter(localeCodes, routesNameSeparator, defaultLocaleRouteNameSuffix); | ||
extendI18n(i18n, { locales: normalizedLocaleCodes, baseUrl, localeCodes }); | ||
const localizedRoutes = localizeRoutes(routes, { | ||
@@ -499,2 +504,3 @@ locales, | ||
}); | ||
extendI18n(i18n, { locales: normalizedLocaleCodes, baseUrl, localeCodes, context: router }); | ||
router.beforeEach((to, from, next) => { | ||
@@ -1044,3 +1050,3 @@ const currentLocale = getLocale(i18n); | ||
} | ||
const VERSION = "0.5.0"; | ||
const VERSION = "0.6.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1047,0 +1053,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -327,3 +327,9 @@ "use strict"; | ||
} | ||
function extendI18n(i18n, { locales = [], localeCodes = [], baseUrl = DEFAULT_BASE_URL, hooks = {}, context = {} } = {}) { | ||
function extendI18n(i18n, { | ||
locales = [], | ||
localeCodes = [], | ||
baseUrl = DEFAULT_BASE_URL, | ||
hooks = {}, | ||
context = {} | ||
} = {}) { | ||
const scope = vueDemi.effectScope(); | ||
@@ -477,3 +483,2 @@ const orgInstall = i18n.install; | ||
const getLocaleFromRoute = createLocaleFromRouteGetter(localeCodes, routesNameSeparator, defaultLocaleRouteNameSuffix); | ||
extendI18n(i18n, { locales: normalizedLocaleCodes, baseUrl, localeCodes }); | ||
const localizedRoutes = localizeRoutes(routes, { | ||
@@ -502,2 +507,3 @@ locales, | ||
}); | ||
extendI18n(i18n, { locales: normalizedLocaleCodes, baseUrl, localeCodes, context: router }); | ||
router.beforeEach((to, from, next) => { | ||
@@ -1047,3 +1053,3 @@ const currentLocale = getLocale(i18n); | ||
} | ||
const VERSION = "0.5.0"; | ||
const VERSION = "0.6.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1050,0 +1056,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.5.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
}, | ||
"version": "0.6.0-45457f4", | ||
"dependencies": { | ||
@@ -117,3 +106,14 @@ "@intlify/shared": "next", | ||
}, | ||
"sideEffects": false | ||
} | ||
"sideEffects": false, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
148584
0.11%4033
0.45%