website-astro/.astro-i18n/generated.d.ts

53 lines
5.8 KiB
TypeScript
Raw Permalink Normal View History

2022-12-05 20:50:35 +01:00
type DefaultLangCode = "fr"
type SupportedLangCode = "en"
2022-12-22 11:01:52 +01:00
type LangCode = DefaultLangCode | SupportedLangCode
2023-06-03 22:27:00 +02:00
type RouteUri = | "/articles/[slug]" | "/articles" | "/agments/[slug]" | "/agments" | "/references" | "/veille" | "/" | "/plan-du-site"
type RouteParams = {"/articles/[slug]": { "slug": string; }; "/articles": undefined; "/agments/[slug]": { "slug": string; }; "/agments": undefined; "/references": undefined; "/veille": undefined; "/": undefined; "/plan-du-site": undefined; }
2023-05-09 10:23:01 +02:00
type TranslationPath = "accueil" | "tagline" | "copyright" | "contact.title" | "contact.email" | "contact.tel" | "contenuVide" | "header.skipLink" | "header.mainNav" | "header.homeLink" | "sitemap" | "prevNext.contenus" | "prevNext.precedent" | "prevNext.suivant" | "article.titre" | "article.tagline" | "article.published" | "meta.publication" | "meta.modification" | "meta.credit" | "fragments.titre" | "fragments.tagline" | "references.titre" | "references.slug" | "references.cta" | "references.tagline" | "veille.titre" | "veille.tagline" | "erreur.introuvable" | "erreur.autre" | "erreur.lienRetour" | "seo.meta.description" | "seo.article.title" | "seo.article.description" | "seo.code.title" | "seo.code.description" | "seo.references.title" | "seo.references.description" | "index.articles.pageName" | "index.articles.subtitle" | "index.fragments.pageName" | "index.fragments.subtitle" | "index.references.pageName" | "index.references.subtitle" | "index.veille.pageName" | "index.veille.subtitle" | "index.title" | "index.subtitle" | "index.quoi" | "index.comment" | "index.opensource" | "index.writing" | "index.latestProjects" | "index.latestArticles" | "index.allProjects" | "index.allArticles" | "index.latestSnippets" | "index.allSnippets" | "index.toc" | "contact.contenuVide"
type TranslationOptions = { "accueil": {} | undefined; "tagline": {} | undefined; "copyright": {} | undefined; "contact.title": {} | undefined; "contact.email": {} | undefined; "contact.tel": {} | undefined; "contenuVide": {} | undefined; "header.skipLink": {} | undefined; "header.mainNav": {} | undefined; "header.homeLink": {} | undefined; "sitemap": {} | undefined; "prevNext.contenus": {} | undefined; "prevNext.precedent": {} | undefined; "prevNext.suivant": {} | undefined; "article.titre": {} | undefined; "article.tagline": {} | undefined; "article.published": { datetime: unknown; options: unknown; }; "meta.publication": {} | undefined; "meta.modification": {} | undefined; "meta.credit": {} | undefined; "fragments.titre": {} | undefined; "fragments.tagline": {} | undefined; "references.titre": {} | undefined; "references.slug": {} | undefined; "references.cta": {} | undefined; "references.tagline": {} | undefined; "veille.titre": {} | undefined; "veille.tagline": {} | undefined; "erreur.introuvable": {} | undefined; "erreur.autre": {} | undefined; "erreur.lienRetour": {} | undefined; "seo.meta.description": {} | undefined; "seo.article.title": {} | undefined; "seo.article.description": {} | undefined; "seo.code.title": {} | undefined; "seo.code.description": {} | undefined; "seo.references.title": {} | undefined; "seo.references.description": {} | undefined; "index.articles.pageName": {} | undefined; "index.articles.subtitle": {} | undefined; "index.fragments.pageName": {} | undefined; "index.fragments.subtitle": {} | undefined; "index.references.pageName": {} | undefined; "index.references.subtitle": {} | undefined; "index.veille.pageName": {} | undefined; "index.veille.subtitle": {} | undefined; "index.title": {} | undefined; "index.subtitle": {} | undefined; "index.quoi": {} | undefined; "index.comment": {} | undefined; "index.opensource": {} | undefined; "index.writing": {} | undefined; "index.latestProjects": {} | undefined; "index.latestArticles": {} | undefined; "index.allProjects": {} | undefined; "index.allArticles": {} | undefined; "index.latestSnippets": {} | undefined; "index.allSnippets": {} | undefined; "index.toc": {} | undefined; "contact.contenuVide": {} | undefined; }
2022-12-02 17:29:11 +01:00
declare module "astro-i18n" {
export * from "astro-i18n/"
export function l<Uri extends RouteUri>(
2022-12-05 20:50:35 +01:00
route: Uri | string & {},
2023-05-09 12:26:03 +02:00
...args: Uri extends keyof RouteParams
? undefined extends RouteParams[Uri]
? [params?: Record<string, string>, targetLangCode?: LangCode, routeLangCode?: LangCode]
: [params: RouteParams[Uri], targetLangCode?: LangCode, routeLangCode?: LangCode]
: [params?: Record<string, string>, targetLangCode?: LangCode, routeLangCode?: LangCode]
2022-12-02 17:29:11 +01:00
): string
export function t<Path extends TranslationPath>(
2023-02-03 11:21:01 +01:00
path: Path | string & {},
2022-12-02 17:29:11 +01:00
...args: undefined extends TranslationOptions[Path]
2023-02-03 11:21:01 +01:00
? [options?: keyof TranslationOptions extends Path ? Record<string, unknown> : TranslationOptions[Path], langCode?: LangCode]
2022-12-02 17:29:11 +01:00
: [options: TranslationOptions[Path], langCode?: LangCode]
): string
2022-12-05 20:50:35 +01:00
2022-12-22 11:01:52 +01:00
export function extractRouteLangCode(route: string): LangCode | undefined
2022-12-05 20:50:35 +01:00
type Translation = string | { [translationKey: string]: string | Translation }
type Translations = { [langCode: string]: Record<string, Translation> }
type RouteTranslations = { [langCode: string]: Record<string, string> }
type InterpolationFormatter = (value: unknown, ...args: unknown[]) => string
class AstroI18n {
defaultLangCode: DefaultLangCode
supportedLangCodes: SupportedLangCode[]
showDefaultLangCode: boolean
translations: Translations
routeTranslations: RouteTranslations
get langCodes(): LangCode[]
get langCode(): LangCode
set langCode(langCode: LangCode)
get formatters(): Record<string, InterpolationFormatter>
2022-12-22 11:01:52 +01:00
init(Astro: { url: URL }, formatters?: Record<string, InterpolationFormatter>): void
2023-02-03 11:21:01 +01:00
addTranslations(translations: Translations): void
addRouteTranslations(routeTranslations: RouteTranslations): void
2022-12-05 20:50:35 +01:00
getFormatter(name: string): InterpolationFormatter | undefined
setFormatter(name: string, formatter: InterpolationFormatter): void
deleteFormatter(name: string): void
}
export const astroI18n: AstroI18n
2022-12-02 17:29:11 +01:00
}