@i18n-micro/path-strategy
Shared strategy-based path and route name builder for Nuxt I18n Micro frontend routing.
Entry points: @i18n-micro/path-strategy, @i18n-micro/path-strategy/types.
@i18n-micro/path-strategy
Functions
createPathStrategy
function createPathStrategy(ctx: PathStrategyContext): PathStrategy
See PathStrategyContext · PathStrategy
Classes
DomainPathStrategy
The strategy of a build with locale domains (baseUrl). On a known host (ctx.domain) the
locales of other domains are no URLs here, only link targets; on any other host the build config
routes and every baseUrl locale is a link target. A class of its own: an app without domains
does not ship it.
class DomainPathStrategy extends I18nPathStrategy {
constructor(ctx: PathStrategyContext)
}
DomainPathStrategy.locale as an absolute URL on another domain: DomainPathStrategy.localeRoute made absolute reads as the page it shows, so it switches like any route.<i18n-link :to="$localeRoute(x, 'de')">).
Any other absolute object stays a path: it can come from a request.See I18nPathStrategy · PathStrategyContext
I18nPathStrategy
class I18nPathStrategy {
constructor(ctx: PathStrategyContext)
}
locale carry the locale segment.DomainPathStrategy.route is served in (every record of it), or null when it is not localized.$defineI18nRoute({ disableMeta }) turns the SEO tags of this page off in locale.locale as an absolute URL on another domain: DomainPathStrategy.index when page translations are off).Types
ClientRedirectOptions
interface ClientRedirectOptions
autoDetectPath: '*': a URL already in another locale moves to the preferred one too
(the same page in that locale), not only unprefixed URLs.PathStrategy
The public surface, structural: the Nuxt template imports the built .mjs by path, and a
class type with private members would not match the one TypeScript infers from that file.
type PathStrategy = {
[K in keyof I18nPathStrategy]: I18nPathStrategy[K];
}
See I18nPathStrategy
PathStrategyContext
interface PathStrategyContext
customRegexMatcher): one that is no known locale is a 404.false: a 404.DomainPathStrategy); unset on a host no locale lives on.domain: every locale. Those missing from locales live on another domain.ResolvedRouteLike
Resolved route (path and fullPath required).
interface ResolvedRouteLike extends RouteLike
RouteRecordNameGeneric).See RouteLike
RouteLike
Route-like shape (compatible with vue-router).
interface RouteLike
RouteRecordNameGeneric).i18nNoMeta marks an unlocalized page's disableMeta.RouterAdapter
interface RouterAdapter
RouteRecordLike
What path-strategy reads from a vue-router record (router.getRoutes()).
interface RouteRecordLike
SwitchLocaleOptions
interface SwitchLocaleOptions
name and params on a route with an escape: for a caller that drops path, so the router encodes them.Re-exports
Declared in another package of this repository and documented on its page.
@i18n-micro/path-strategy/types
Also exports, as @i18n-micro/path-strategy does: ClientRedirectOptions · PathStrategyContext · ResolvedRouteLike · RouteI18nMeta · RouteLike · RouterAdapter · RouteRecordLike · SwitchLocaleOptions.
Generated from the TypeScript sources and their JSDoc by pnpm run docs:generate.
Back to all packages · Integration guides