-
-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: nuxt context injected function types (#3098)
- Loading branch information
1 parent
a3fb89f
commit 97528e9
Showing
11 changed files
with
114 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<template> | ||
<div> | ||
<p>This is blog index page</p> | ||
<NuxtLink id="link-blog-article" exact :to="localePath('blog-article')">article</NuxtLink> | ||
<NuxtLink id="link-blog-article" exact :to="$localePath('blog-article')">article</NuxtLink> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<template> | ||
<div> | ||
<p>This is blog index page</p> | ||
<NuxtLink id="link-blog-article" exact :to="localePath('blog-article')">article</NuxtLink> | ||
<NuxtLink id="link-blog-article" exact :to="$localePath('blog-article')">article</NuxtLink> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<template> | ||
<div> | ||
<p>This is blog index page</p> | ||
<NuxtLink id="link-blog-article" exact :to="localePath('blog-article')">article</NuxtLink> | ||
<NuxtLink id="link-blog-article" exact :to="$localePath('blog-article')">article</NuxtLink> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import type { | ||
LocaleHeadFunction, | ||
LocalePathFunction, | ||
LocaleRouteFunction, | ||
RouteBaseNameFunction, | ||
SwitchLocalePathFunction | ||
} from '#i18n' | ||
import type { | ||
getRouteBaseName, | ||
localeHead, | ||
localePath, | ||
localeRoute, | ||
switchLocalePath | ||
} from './routing/compatibles/index' | ||
|
||
export type NuxtI18nPluginInjections = { | ||
/** | ||
* Returns base name of current (if argument not provided) or passed in route. | ||
* | ||
* @remarks | ||
* Base name is name of the route without locale suffix and other metadata added by nuxt i18n module | ||
* | ||
* @param givenRoute - A route. | ||
* | ||
* @returns The route base name. if cannot get, `undefined` is returned. | ||
*/ | ||
getRouteBaseName: (...args: Parameters<RouteBaseNameFunction>) => ReturnType<typeof getRouteBaseName> | ||
/** | ||
* Returns localized path for passed in route. | ||
* | ||
* @remarks | ||
* If locale is not specified, uses current locale. | ||
* | ||
* @param route - A route. | ||
* @param locale - A locale, optional. | ||
* | ||
* @returns A path of the current route. | ||
*/ | ||
localePath: (...args: Parameters<LocalePathFunction>) => ReturnType<typeof localePath> | ||
/** | ||
* Returns localized route for passed in `route` parameters. | ||
* | ||
* @remarks | ||
* If `locale` is not specified, uses current locale. | ||
* | ||
* @param route - A route. | ||
* @param locale - A {@link Locale | locale}, optional. | ||
* | ||
* @returns A route. if cannot resolve, `undefined` is returned. | ||
*/ | ||
localeRoute: (...args: Parameters<LocaleRouteFunction>) => ReturnType<typeof localeRoute> | ||
/** | ||
* Returns localized head properties for locale-related aspects. | ||
* | ||
* @param options - An options object, see `I18nHeadOptions`. | ||
* | ||
* @returns The localized head properties. | ||
*/ | ||
localeHead: (...args: Parameters<LocaleHeadFunction>) => ReturnType<typeof localeHead> | ||
/** | ||
* Returns path of the current route for specified locale | ||
* | ||
* @param locale - A {@link Locale} | ||
* | ||
* @returns A path of the current route | ||
*/ | ||
switchLocalePath: (...args: Parameters<SwitchLocalePathFunction>) => ReturnType<typeof switchLocalePath> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters