Skip to content

@i18n-micro/path-strategy

38 exports across 6 entry points. Generated from the API snapshot that pnpm run api:surface checks against the TypeScript sources.

@i18n-micro/path-strategy

ts
import { /* … */ } from '@i18n-micro/path-strategy'
ExportKindSignature
analyzeRoutefunction(ctx: PathStrategyContext, route: ResolvedRouteLike) => RouteAnalysis
BasePathStrategyclass36 members
buildLocalizedNamefunction(baseName: string, locale: string, prefix?: string) => string
createPathStrategyfunction(ctx: PathStrategyContext) => PathStrategy
getRouteBaseNamefunction(route: { name?: string | null; } & Record<string, any>, options: GetRouteBaseNameOptions) => string | null
GetRouteBaseNameOptionsinterface2 members
GlobalLocaleRoutestypeRecord<string, Record<string, string> | false | boolean>
isIndexRouteNamefunction(name: string | null | undefined, options?: IsIndexRouteNameOptions) => boolean
IsIndexRouteNameOptionsinterface2 members
NoPrefixPathStrategyclass36 members
NormalizedRouteInputtype| { kind: 'path'; path: string } | { kind: 'route'; inputName: string | null; sourceRoute: RouteLike; resolved: ResolvedRouteLike }
PathStrategyinterface22 members
PathStrategyContextinterface15 members
PrefixAndDefaultPathStrategyclass37 members
PrefixExceptDefaultPathStrategyclass44 members
PrefixPathStrategyclass36 members
ResolvedRouteLikeinterface6 members
resolvePathWithParamsfunction(path: string, params?: Record<string, unknown>) => string
RouteAnalysisinterface2 members
RouteLikeinterface6 members
RouterAdapterinterface3 members
SwitchLocaleOptionsinterface1 members
BasePathStrategy — 36 members
MemberType
_ensureRouteLike(value: RouteLike | string, source?: RouteLike | null) => RouteLike
_normalizeRouteInput(routeOrPath: RouteLike | string, _currentRoute?: ResolvedRouteLike) => NormalizedRouteInput
applyBaseUrl(localeCode: string, route: RouteLike | string) => RouteLike | string
buildLocalizedName(baseName: string, locale: string) => string
buildLocalizedPath(path: string, locale: string, _isCustom: boolean) => string
buildLocalizedRouteName(baseName: string, locale: string) => string
ctxPathStrategyContext
detectLocaleFromName(name: string | null) => string | null
formatPathForResolve(path: string, fromLocale: string, _toLocale: string) => string
getBaseRouteName(route: RouteLike, locale: string) => string | null
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(currentPath: string, preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => PathStrategyContext["globalLocaleRoutes"]
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNoPrefixRedirect() => boolean | undefined
getPathWithoutLocale(path: string) => { pathWithoutLocale: string; localeFromPath: string | null; }
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, targetLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => PathStrategyContext["routeLocales"]
getRoutesLocaleLinks() => PathStrategyContext["routesLocaleLinks"]
getStrategy() => PathStrategyContext["strategy"]
getSwitchLocaleFallbackWhenNoRoute(route: ResolvedRouteLike, targetName: string) => RouteLike | string
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
newabstract (ctx: PathStrategyContext): BasePathStrategy
resolveLocaleFromPath(path: string) => string | null
resolveLocaleRoute(targetLocale: string, normalized: NormalizedRouteInput, _currentRoute?: ResolvedRouteLike) => RouteLike | string
resolvePathForLocale(path: string, targetLocale: string) => string
setRouter(router: RouterAdapter) => void
shouldReturn404(currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
GetRouteBaseNameOptions — 2 members
MemberType
locales{ code: string; }[]
localizedRouteNamePrefix?string | undefined
IsIndexRouteNameOptions — 2 members
MemberType
localeCodes?readonly string[] | undefined
localizedRouteNamePrefix?string | undefined
NoPrefixPathStrategy — 36 members
MemberType
_ensureRouteLike(value: RouteLike | string, source?: RouteLike | null) => RouteLike
_normalizeRouteInput(routeOrPath: RouteLike | string, _currentRoute?: ResolvedRouteLike) => NormalizedRouteInput
applyBaseUrl(localeCode: string, route: RouteLike | string) => RouteLike | string
buildLocalizedName(baseName: string, locale: string) => string
buildLocalizedPath(path: string, _locale: string, _isCustom: boolean) => string
buildLocalizedRouteName(baseName: string, locale: string) => string
ctxPathStrategyContext
detectLocaleFromName(name: string | null) => string | null
formatPathForResolve(path: string, _fromLocale: string, _toLocale: string) => string
getBaseRouteName(route: RouteLike, locale: string) => string | null
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(_currentPath: string, _preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => PathStrategyContext["globalLocaleRoutes"]
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNoPrefixRedirect() => boolean | undefined
getPathWithoutLocale(path: string) => { pathWithoutLocale: string; localeFromPath: string | null; }
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, _targetLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => PathStrategyContext["routeLocales"]
getRoutesLocaleLinks() => PathStrategyContext["routesLocaleLinks"]
getStrategy() => PathStrategyContext["strategy"]
getSwitchLocaleFallbackWhenNoRoute(route: ResolvedRouteLike, _targetName: string) => RouteLike | string
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
new(ctx: PathStrategyContext): NoPrefixPathStrategy
resolveLocaleFromPath(_path: string) => string | null
resolveLocaleRoute(targetLocale: string, normalized: NormalizedRouteInput, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolvePathForLocale(path: string, targetLocale: string) => string
setRouter(router: RouterAdapter) => void
shouldReturn404(_currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
PathStrategy — 22 members
MemberType
formatPathForResolve(path: string, fromLocale: string, toLocale: string) => string
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(currentPath: string, preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => GlobalLocaleRoutes | undefined
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNoPrefixRedirect() => boolean | undefined
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, targetLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => Record<string, string[]> | undefined
getRoutesLocaleLinks() => Record<string, string> | undefined
getStrategy() => Strategies
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
resolveLocaleFromPath(path: string) => string | null
setRouter(router: RouterAdapter) => void
shouldReturn404(currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
PathStrategyContext — 15 members
MemberType
_hasGR?boolean | undefined
_hasRL?boolean | undefined
debug?boolean | undefined
defaultLocalestring
disablePageLocales?boolean | undefined
globalLocaleRoutes?GlobalLocaleRoutes | undefined
hashMode?boolean | undefined
localeCodes?readonly string[] | undefined
localesLocale[]
localizedRouteNamePrefixstring
noPrefixRedirect?boolean | undefined
routeLocales?Record<string, string[]> | undefined
routerRouterAdapter
routesLocaleLinks?Record<string, string> | undefined
strategyStrategies
PrefixAndDefaultPathStrategy — 37 members
MemberType
_ensureRouteLike(value: RouteLike | string, source?: RouteLike | null) => RouteLike
_normalizeRouteInput(routeOrPath: RouteLike | string, _currentRoute?: ResolvedRouteLike) => NormalizedRouteInput
applyBaseUrl(localeCode: string, route: RouteLike | string) => RouteLike | string
buildLocalizedName(baseName: string, locale: string) => string
buildLocalizedPath(path: string, locale: string, _isCustom: boolean) => string
buildLocalizedRouteName(baseName: string, locale: string) => string
ctxPathStrategyContext
detectLocaleFromName(name: string | null) => string | null
formatPathForResolve(path: string, fromLocale: string, _toLocale: string) => string
getBaseRouteName(route: RouteLike, locale: string) => string | null
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(currentPath: string, _preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => PathStrategyContext["globalLocaleRoutes"]
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNoPrefixRedirect() => boolean | undefined
getPathWithoutLocale(path: string) => { pathWithoutLocale: string; localeFromPath: string | null; }
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, detectedLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => PathStrategyContext["routeLocales"]
getRoutesLocaleLinks() => PathStrategyContext["routesLocaleLinks"]
getStrategy() => PathStrategyContext["strategy"]
getSwitchLocaleFallbackWhenNoRoute(route: ResolvedRouteLike, targetName: string) => RouteLike | string
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
new(ctx: PathStrategyContext): PrefixAndDefaultPathStrategy
resolveLocaleFromPath(path: string) => string | null
resolveLocaleRoute(targetLocale: string, normalized: NormalizedRouteInput, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolvePathForLocale(path: string, targetLocale: string) => string
rewriteWithLocalePrefixprivate (route: RouteLike, targetLocale: string) => RouteLike
setRouter(router: RouterAdapter) => void
shouldReturn404(currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
PrefixExceptDefaultPathStrategy — 44 members
MemberType
_ensureRouteLike(value: RouteLike | string, source?: RouteLike | null) => RouteLike
_normalizeRouteInput(routeOrPath: RouteLike | string, _currentRoute?: ResolvedRouteLike) => NormalizedRouteInput
applyBaseUrl(localeCode: string, route: RouteLike | string) => RouteLike | string
buildLocalizedName(baseName: string, locale: string) => string
buildLocalizedPath(path: string, locale: string, _isCustom: boolean) => string
buildLocalizedRouteName(baseName: string, locale: string) => string
buildNestedCustomResultprivate (customPath: string, routeName: string, targetLocale: string, needsPrefix: boolean, sourceRoute: RouteLike, currentRoute?: ResolvedRouteLike) => RouteLike | string
ctxPathStrategyContext
detectLocaleFromName(name: string | null) => string | null
formatPathForResolve(path: string, fromLocale: string, toLocale: string) => string
getBaseRouteName(route: RouteLike, locale: string) => string | null
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(currentPath: string, preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => PathStrategyContext["globalLocaleRoutes"]
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNestedRouteInfoprivate (baseRouteName: string) => { parentKey: string; keyWithSlash: string; } | null
getNoPrefixRedirect() => boolean | undefined
getParentPathForTargetprivate (parentKey: string, keyWithSlash: string, targetLocale: string, currentRoute?: ResolvedRouteLike) => string
getPathWithoutLocale(path: string) => { pathWithoutLocale: string; localeFromPath: string | null; }
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, detectedLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => PathStrategyContext["routeLocales"]
getRoutesLocaleLinks() => PathStrategyContext["routesLocaleLinks"]
getStrategy() => PathStrategyContext["strategy"]
getSwitchLocaleFallbackWhenNoRoute(route: ResolvedRouteLike, targetName: string) => RouteLike | string
isLocaleRulesprivate (key: string) => boolean
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
new(ctx: PathStrategyContext): PrefixExceptDefaultPathStrategy
resolveLocaleFromPath(path: string) => string | null
resolveLocaleRoute(targetLocale: string, normalized: NormalizedRouteInput, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolveLocaleRouteFallbackprivate (targetLocale: string, resolved: ResolvedRouteLike, sourceRoute: RouteLike, needsPrefix: boolean, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolveLocaleRouteFullprivate (targetLocale: string, inputName: string | null, sourceRoute: RouteLike, resolved: ResolvedRouteLike, needsPrefix: boolean, hasParams: boolean, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolveLocaleRouteSimpleprivate (targetLocale: string, inputName: string | null, sourceRoute: RouteLike, resolved: ResolvedRouteLike, needsPrefix: boolean, hasParams: boolean, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolvePathForLocale(path: string, targetLocale: string) => string
setRouter(router: RouterAdapter) => void
shouldHavePrefixprotected (locale: string) => boolean
shouldReturn404(currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
PrefixPathStrategy — 36 members
MemberType
_ensureRouteLike(value: RouteLike | string, source?: RouteLike | null) => RouteLike
_normalizeRouteInput(routeOrPath: RouteLike | string, _currentRoute?: ResolvedRouteLike) => NormalizedRouteInput
applyBaseUrl(localeCode: string, route: RouteLike | string) => RouteLike | string
buildLocalizedName(baseName: string, locale: string) => string
buildLocalizedPath(path: string, locale: string, _isCustom: boolean) => string
buildLocalizedRouteName(baseName: string, locale: string) => string
ctxPathStrategyContext
detectLocaleFromName(name: string | null) => string | null
formatPathForResolve(path: string, fromLocale: string, _toLocale: string) => string
getBaseRouteName(route: RouteLike, locale: string) => string | null
getCanonicalPath(route: ResolvedRouteLike, targetLocale: string) => string | null
getClientRedirect(currentPath: string, preferredLocale: string) => string | null
getCurrentLocale(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string
getCurrentLocaleName(route: ResolvedRouteLike, defaultLocaleOverride?: string | null) => string | null
getDefaultLocale() => string
getGlobalLocaleRoutes() => PathStrategyContext["globalLocaleRoutes"]
getLocaleFromPath(path: string) => string | null
getLocales() => Locale[]
getLocalizedRouteNamePrefix() => string
getNoPrefixRedirect() => boolean | undefined
getPathWithoutLocale(path: string) => { pathWithoutLocale: string; localeFromPath: string | null; }
getPluginRouteName(route: ResolvedRouteLike, locale: string) => string
getRedirect(currentPath: string, detectedLocale: string) => string | null
getRouteBaseName(route: RouteLike, locale?: string) => string | null
getRouteLocales() => PathStrategyContext["routeLocales"]
getRoutesLocaleLinks() => PathStrategyContext["routesLocaleLinks"]
getStrategy() => PathStrategyContext["strategy"]
getSwitchLocaleFallbackWhenNoRoute(route: ResolvedRouteLike, targetName: string) => RouteLike | string
localeRoute(targetLocale: string, routeOrPath: RouteLike | string, currentRoute?: ResolvedRouteLike) => RouteLike
new(ctx: PathStrategyContext): PrefixPathStrategy
resolveLocaleFromPath(path: string) => string | null
resolveLocaleRoute(targetLocale: string, normalized: NormalizedRouteInput, currentRoute?: ResolvedRouteLike) => RouteLike | string
resolvePathForLocale(path: string, targetLocale: string) => string
setRouter(router: RouterAdapter) => void
shouldReturn404(currentPath: string) => string | null
switchLocaleRoute(fromLocale: string, toLocale: string, route: ResolvedRouteLike, options: SwitchLocaleOptions) => RouteLike | string
ResolvedRouteLike — 6 members
MemberType
fullPathstring
hash?string | undefined
namestring | null
params?Record<string, unknown> | undefined
pathstring
query?Record<string, unknown> | undefined
RouteAnalysis — 2 members
MemberType
baseRouteNamestring | null
pathWithoutLocalestring
RouteLike — 6 members
MemberType
fullPath?string | undefined
hash?string | undefined
name?string | null | undefined
params?Record<string, unknown> | undefined
path?string | undefined
query?Record<string, unknown> | undefined
RouterAdapter — 3 members
MemberType
getRoutes?(() => unknown[]) | undefined
hasRoute(name: string) => boolean
resolve(to: RouteLike | string) => ResolvedRouteLike
SwitchLocaleOptions — 1 members
MemberType
i18nRouteParams?I18nRouteParams | undefined
## `@i18n-micro/path-strategy/no-prefix`
ts
import { /* … */ } from '@i18n-micro/path-strategy/no-prefix'
ExportKindSignature
NoPrefixPathStrategyclass36 members
Strategyclass36 members

NoPrefixPathStrategy — 36 members, identical to NoPrefixPathStrategy above. Strategy — 36 members, identical to NoPrefixPathStrategy above.

@i18n-micro/path-strategy/prefix

ts
import { /* … */ } from '@i18n-micro/path-strategy/prefix'
ExportKindSignature
PrefixPathStrategyclass36 members
Strategyclass36 members

PrefixPathStrategy — 36 members, identical to PrefixPathStrategy above. Strategy — 36 members, identical to PrefixPathStrategy above.

@i18n-micro/path-strategy/prefix-and-default

ts
import { /* … */ } from '@i18n-micro/path-strategy/prefix-and-default'
ExportKindSignature
PrefixAndDefaultPathStrategyclass37 members
Strategyclass37 members

PrefixAndDefaultPathStrategy — 37 members, identical to PrefixAndDefaultPathStrategy above. Strategy — 37 members, identical to PrefixAndDefaultPathStrategy above.

@i18n-micro/path-strategy/prefix-except-default

ts
import { /* … */ } from '@i18n-micro/path-strategy/prefix-except-default'
ExportKindSignature
PrefixExceptDefaultPathStrategyclass44 members
Strategyclass44 members

PrefixExceptDefaultPathStrategy — 44 members, identical to PrefixExceptDefaultPathStrategy above. Strategy — 44 members, identical to PrefixExceptDefaultPathStrategy above.

@i18n-micro/path-strategy/types

ts
import { /* … */ } from '@i18n-micro/path-strategy/types'
ExportKindSignature
GlobalLocaleRoutestypeRecord<string, Record<string, string> | false | boolean>
NormalizedRouteInputtype| { kind: 'path'; path: string } | { kind: 'route'; inputName: string | null; sourceRoute: RouteLike; resolved: ResolvedRouteLike }
PathStrategyinterface22 members
PathStrategyContextinterface15 members
ResolvedRouteLikeinterface6 members
RouteLikeinterface6 members
RouterAdapterinterface3 members
SwitchLocaleOptionsinterface1 members

PathStrategy — 22 members, identical to PathStrategy above. PathStrategyContext — 15 members, identical to PathStrategyContext above. ResolvedRouteLike — 6 members, identical to ResolvedRouteLike above. RouteLike — 6 members, identical to RouteLike above. RouterAdapter — 3 members, identical to RouterAdapter above. SwitchLocaleOptions — 1 members, identical to SwitchLocaleOptions above.

Back to all packages · Integration guides

Released under the MIT License.