@tenphi/renderer 0.21.2 → 0.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/code-copy.js +1 -1
- package/dist/client/heading-links.js +1 -1
- package/dist/client/page-copy.js +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/localization.d.ts +2 -42
- package/dist/localization.d.ts.map +1 -1
- package/dist/localization.js +1 -87
- package/dist/localization.js.map +1 -1
- package/dist/messages-BqBGDIoP.js +143 -0
- package/dist/messages-BqBGDIoP.js.map +1 -0
- package/dist/messages-ClTf2nFf.d.ts +52 -0
- package/dist/messages-ClTf2nFf.d.ts.map +1 -0
- package/dist/{messages-B_3xUzUb.js → messages-bS8G9Pj8.js} +2 -2
- package/dist/{messages-B_3xUzUb.js.map → messages-bS8G9Pj8.js.map} +1 -1
- package/dist/ui.d.ts +2 -6
- package/dist/ui.js +1 -58
- package/package.json +2 -2
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js.map +0 -1
package/dist/localization.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResolvedNavigationLayout } from "./navigation.js";
|
|
2
|
+
import { n as MessageKey, r as messages, t as ENGLISH_MESSAGES } from "./messages-ClTf2nFf.js";
|
|
2
3
|
import { DocsConfig, DocsRoute } from "@tenphi/docs";
|
|
3
4
|
//#region src/localization.d.ts
|
|
4
5
|
type LocaleOptions = {
|
|
@@ -19,51 +20,10 @@ declare function localizedNavigation(layout: ResolvedNavigationLayout, routes: D
|
|
|
19
20
|
layout: ResolvedNavigationLayout;
|
|
20
21
|
routes: DocsRoute[];
|
|
21
22
|
};
|
|
22
|
-
declare const ENGLISH_MESSAGES: {
|
|
23
|
-
readonly copyPage: "Copy page";
|
|
24
|
-
readonly viewMarkdown: "Download Markdown";
|
|
25
|
-
readonly pageCopied: "Page copied";
|
|
26
|
-
readonly pageCopyError: "Could not copy. Download Markdown to read or copy the text.";
|
|
27
|
-
readonly draftTitle: "Draft";
|
|
28
|
-
readonly draftNotice: "This page is available by direct link and excluded from navigation and indexes.";
|
|
29
|
-
readonly searchError: "Search could not load. Close and try again.";
|
|
30
|
-
readonly appearance: "Appearance";
|
|
31
|
-
readonly colorScheme: "Color scheme";
|
|
32
|
-
readonly contrast: "Contrast";
|
|
33
|
-
readonly normalContrast: "Normal";
|
|
34
|
-
readonly highContrast: "High";
|
|
35
|
-
readonly auto: "Auto";
|
|
36
|
-
readonly closeNavigation: "Close navigation";
|
|
37
|
-
readonly primary: "Primary";
|
|
38
|
-
readonly sections: "Sections";
|
|
39
|
-
readonly chooseSection: "Choose section";
|
|
40
|
-
readonly headerLinks: "Header links";
|
|
41
|
-
readonly more: "More";
|
|
42
|
-
readonly closeMore: "Close more menu";
|
|
43
|
-
readonly moreLinks: "More links";
|
|
44
|
-
readonly versions: "Versions";
|
|
45
|
-
readonly documentationVersion: "Documentation version";
|
|
46
|
-
readonly documentationVersions: "Documentation versions";
|
|
47
|
-
readonly version: "Version";
|
|
48
|
-
readonly home: "Home";
|
|
49
|
-
readonly generatedWith: "Generated with";
|
|
50
|
-
readonly viewSource: "View source";
|
|
51
|
-
readonly copyCode: "Copy code";
|
|
52
|
-
readonly codeCopied: "Code copied";
|
|
53
|
-
readonly codeCopyError: "Could not copy code";
|
|
54
|
-
readonly copyHeading: "Copy link to “{heading}”";
|
|
55
|
-
readonly linkCopied: "Link copied";
|
|
56
|
-
readonly linkCopyError: "Could not copy link";
|
|
57
|
-
readonly notFound: "Page not found";
|
|
58
|
-
readonly notFoundDescription: "The page you requested could not be found.";
|
|
59
|
-
readonly fallback: "fallback";
|
|
60
|
-
};
|
|
61
|
-
type MessageKey = keyof typeof ENGLISH_MESSAGES;
|
|
62
|
-
declare function messages(lang: string, options?: LocaleOptions): Record<MessageKey, string>;
|
|
63
23
|
declare function localeAlternates(path: string, routes: DocsRoute[], options: LocaleOptions): Array<{
|
|
64
24
|
lang: string;
|
|
65
25
|
route: string;
|
|
66
26
|
}>;
|
|
67
27
|
//#endregion
|
|
68
|
-
export { ENGLISH_MESSAGES, MessageKey, localeAlternates, localeHref, localePath, localeTarget, localizedNavigation, localizedRoute, messages, requestLanguage, routeLocale };
|
|
28
|
+
export { ENGLISH_MESSAGES, type MessageKey, localeAlternates, localeHref, localePath, localeTarget, localizedNavigation, localizedRoute, messages, requestLanguage, routeLocale };
|
|
69
29
|
//# sourceMappingURL=localization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.d.ts","names":[],"sources":["../src/localization.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"localization.d.ts","names":[],"sources":["../src/localization.ts"],"mappings":";;;;KAMK;EACH,UAAU;EACV,gBAAgB;EAChB,eAAe;;iBAGD,YAAY,cAAc,SAAS;;iBAMnC,gBACd,kBACA,cACA,SAAS;iBAWK,WAAW,cAAc,SAAS;iBAQlC,eACd,cACA,gBACA,SAAS;;iBASK,aACd,cACA,gBACA,QAAQ,aACR,SAAS;iBAoBK,WACd,cACA,qBACA,QAAQ,aACR,SAAS,eACT;;iBAec,oBACd,QAAQ,0BACR,QAAQ,aACR,qBACA,SAAS;EACN,QAAQ;EAA0B,QAAQ;;iBAgG/B,iBACd,cACA,QAAQ,aACR,SAAS,gBACR;EAAQ;EAAc"}
|
package/dist/localization.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { normalizeNavigationPath } from "./navigation.js";
|
|
2
|
+
import { n as messages, t as ENGLISH_MESSAGES } from "./messages-BqBGDIoP.js";
|
|
2
3
|
//#region src/localization.ts
|
|
3
4
|
function routeLocale(path, options) {
|
|
4
5
|
const first = normalizeNavigationPath(path).split("/")[1];
|
|
@@ -99,93 +100,6 @@ function localizedNavigation(layout, routes, currentPath, options) {
|
|
|
99
100
|
routes: localRoutes
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
|
-
const ENGLISH_MESSAGES = {
|
|
103
|
-
copyPage: "Copy page",
|
|
104
|
-
viewMarkdown: "Download Markdown",
|
|
105
|
-
pageCopied: "Page copied",
|
|
106
|
-
pageCopyError: "Could not copy. Download Markdown to read or copy the text.",
|
|
107
|
-
draftTitle: "Draft",
|
|
108
|
-
draftNotice: "This page is available by direct link and excluded from navigation and indexes.",
|
|
109
|
-
searchError: "Search could not load. Close and try again.",
|
|
110
|
-
appearance: "Appearance",
|
|
111
|
-
colorScheme: "Color scheme",
|
|
112
|
-
contrast: "Contrast",
|
|
113
|
-
normalContrast: "Normal",
|
|
114
|
-
highContrast: "High",
|
|
115
|
-
auto: "Auto",
|
|
116
|
-
closeNavigation: "Close navigation",
|
|
117
|
-
primary: "Primary",
|
|
118
|
-
sections: "Sections",
|
|
119
|
-
chooseSection: "Choose section",
|
|
120
|
-
headerLinks: "Header links",
|
|
121
|
-
more: "More",
|
|
122
|
-
closeMore: "Close more menu",
|
|
123
|
-
moreLinks: "More links",
|
|
124
|
-
versions: "Versions",
|
|
125
|
-
documentationVersion: "Documentation version",
|
|
126
|
-
documentationVersions: "Documentation versions",
|
|
127
|
-
version: "Version",
|
|
128
|
-
home: "Home",
|
|
129
|
-
generatedWith: "Generated with",
|
|
130
|
-
viewSource: "View source",
|
|
131
|
-
copyCode: "Copy code",
|
|
132
|
-
codeCopied: "Code copied",
|
|
133
|
-
codeCopyError: "Could not copy code",
|
|
134
|
-
copyHeading: "Copy link to “{heading}”",
|
|
135
|
-
linkCopied: "Link copied",
|
|
136
|
-
linkCopyError: "Could not copy link",
|
|
137
|
-
notFound: "Page not found",
|
|
138
|
-
notFoundDescription: "The page you requested could not be found.",
|
|
139
|
-
fallback: "fallback"
|
|
140
|
-
};
|
|
141
|
-
const FRENCH_MESSAGES = {
|
|
142
|
-
copyPage: "Copier la page",
|
|
143
|
-
viewMarkdown: "Télécharger le Markdown",
|
|
144
|
-
pageCopied: "Page copiée",
|
|
145
|
-
pageCopyError: "Copie impossible. Téléchargez le Markdown pour lire ou copier le texte.",
|
|
146
|
-
draftTitle: "Brouillon",
|
|
147
|
-
draftNotice: "Cette page est accessible par son lien direct et exclue de la navigation et des index.",
|
|
148
|
-
searchError: "La recherche n’a pas pu se charger. Fermez et réessayez.",
|
|
149
|
-
appearance: "Apparence",
|
|
150
|
-
colorScheme: "Thème de couleur",
|
|
151
|
-
contrast: "Contraste",
|
|
152
|
-
normalContrast: "Normal",
|
|
153
|
-
highContrast: "Élevé",
|
|
154
|
-
auto: "Auto",
|
|
155
|
-
closeNavigation: "Fermer la navigation",
|
|
156
|
-
primary: "Navigation principale",
|
|
157
|
-
sections: "Sections",
|
|
158
|
-
chooseSection: "Choisir une section",
|
|
159
|
-
headerLinks: "Liens d’en-tête",
|
|
160
|
-
more: "Plus",
|
|
161
|
-
closeMore: "Fermer le menu",
|
|
162
|
-
moreLinks: "Autres liens",
|
|
163
|
-
versions: "Versions",
|
|
164
|
-
documentationVersion: "Version de la documentation",
|
|
165
|
-
documentationVersions: "Versions de la documentation",
|
|
166
|
-
version: "Version",
|
|
167
|
-
home: "Accueil",
|
|
168
|
-
generatedWith: "Créé avec",
|
|
169
|
-
viewSource: "Voir le code source",
|
|
170
|
-
copyCode: "Copier le code",
|
|
171
|
-
codeCopied: "Code copié",
|
|
172
|
-
codeCopyError: "Impossible de copier le code",
|
|
173
|
-
copyHeading: "Copier le lien vers « {heading} »",
|
|
174
|
-
linkCopied: "Lien copié",
|
|
175
|
-
linkCopyError: "Impossible de copier le lien",
|
|
176
|
-
notFound: "Page introuvable",
|
|
177
|
-
notFoundDescription: "La page demandée est introuvable.",
|
|
178
|
-
fallback: "langue de secours"
|
|
179
|
-
};
|
|
180
|
-
function messages(lang, options = {}) {
|
|
181
|
-
const language = lang.split("-")[0] ?? "en";
|
|
182
|
-
return {
|
|
183
|
-
...ENGLISH_MESSAGES,
|
|
184
|
-
...language === "fr" ? FRENCH_MESSAGES : {},
|
|
185
|
-
...options.translations?.[language],
|
|
186
|
-
...options.translations?.[lang]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
103
|
function localeAlternates(path, routes, options) {
|
|
190
104
|
const available = new Set(routes.filter((route) => route.discoverable !== false).map((route) => route.route));
|
|
191
105
|
if (!options.locales || !available.has(path)) return [];
|
package/dist/localization.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.js","names":[],"sources":["../src/localization.ts"],"sourcesContent":["import type { DocsConfig, DocsRoute, NavigationItem } from \"@tenphi/docs\";\nimport {\n normalizeNavigationPath,\n type ResolvedNavigationLayout,\n} from \"./navigation.js\";\n\ntype LocaleOptions = {\n locales?: DocsConfig[\"locales\"] | undefined;\n defaultLocale?: DocsConfig[\"defaultLocale\"] | undefined;\n translations?: DocsConfig[\"translations\"] | undefined;\n};\n\nexport function routeLocale(path: string, options: LocaleOptions): string {\n const first = normalizeNavigationPath(path).split(\"/\")[1];\n return first && first !== \"root\" && options.locales?.[first] ? first : \"root\";\n}\n\n/** Author components can render before the page initializes route locals. */\nexport function requestLanguage(\n pathname: string,\n base: string,\n options: LocaleOptions,\n): string {\n const prefix = base.replace(/\\/$/, \"\");\n const path =\n prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))\n ? pathname.slice(prefix.length)\n : pathname;\n const locale = routeLocale(path, options);\n return options.locales?.[locale]?.lang ?? (locale === \"root\" ? \"en\" : locale);\n}\n\nexport function localePath(path: string, options: LocaleOptions): string {\n const route = normalizeNavigationPath(path);\n const locale = routeLocale(route, options);\n return locale === \"root\"\n ? route\n : normalizeNavigationPath(route.slice(locale.length + 1));\n}\n\nexport function localizedRoute(\n path: string,\n locale: string,\n options: LocaleOptions,\n): string {\n const suffix = localePath(path, options);\n return normalizeNavigationPath(\n `${locale === \"root\" ? \"\" : `/${locale}`}${suffix}`,\n );\n}\n\n/** Missing translations use a real default-language page, then a real locale home. */\nexport function localeTarget(\n path: string,\n locale: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n): string | undefined {\n const visible = new Set(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n const fallback =\n options.defaultLocale ??\n (options.locales?.root\n ? \"root\"\n : (Object.keys(options.locales ?? {})[0] ?? \"root\"));\n return [\n localizedRoute(path, locale, options),\n localizedRoute(path, fallback, options),\n localizedRoute(\"/\", locale, options),\n localizedRoute(\"/\", fallback, options),\n ].find((route) => visible.has(route));\n}\n\nexport function localeHref(\n link: string,\n currentPath: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n base = \"/\",\n): string {\n if (!link.startsWith(\"/\") || link.startsWith(\"//\")) return link;\n const suffix = /[?#].*$/.exec(link)?.[0] ?? \"\";\n const path = suffix ? link.slice(0, -suffix.length) : link;\n const target = options.locales\n ? localeTarget(path, routeLocale(currentPath, options), routes, options)\n : normalizeNavigationPath(path);\n return (\n `${base.replace(/\\/$/, \"\")}${target ?? normalizeNavigationPath(path)}${suffix}` ||\n \"/\"\n );\n}\n\n/** Resolve navigation against the current locale's available routes. */\nexport function localizedNavigation(\n layout: ResolvedNavigationLayout,\n routes: DocsRoute[],\n currentPath: string,\n options: LocaleOptions,\n): { layout: ResolvedNavigationLayout; routes: DocsRoute[] } {\n if (!options.locales) return { layout, routes };\n const locale = routeLocale(currentPath, options);\n const language =\n options.locales[locale]?.lang ?? (locale === \"root\" ? \"en\" : locale);\n const label = (value: string) =>\n options.translations?.[language]?.[`navigation.${value}`] ??\n options.translations?.[language.split(\"-\")[0]!]?.[`navigation.${value}`] ??\n value;\n const localRoutes = routes\n .filter((route) => routeLocale(route.route, options) === locale)\n .map((route) => ({ ...route, route: localePath(route.route, options) }));\n const available = new Set(\n localRoutes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n const visibleRoutes = new Map(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => [route.route, route]),\n );\n const fallbackLocale =\n options.defaultLocale ??\n (options.locales.root ? \"root\" : Object.keys(options.locales)[0]!);\n const convert = (items: NavigationItem[]): NavigationItem[] =>\n items.flatMap((item): NavigationItem[] => {\n const link = typeof item === \"string\" ? item : item.link;\n const internal = link?.startsWith(\"/\") && !link.startsWith(\"//\");\n const translated = internal ? localePath(link!, options) : link;\n const fallback = internal\n ? localizedRoute(link!, fallbackLocale, options)\n : undefined;\n const target =\n !internal || available.has(translated!)\n ? translated\n : fallback && visibleRoutes.has(fallback)\n ? fallback\n : undefined;\n if (typeof item === \"string\") {\n if (!target) return [];\n if (!internal || available.has(translated!)) return [target];\n const route = visibleRoutes.get(target)!;\n return [\n {\n label:\n typeof route.sidebar === \"object\" && route.sidebar.label\n ? route.sidebar.label\n : route.title,\n link: target,\n },\n ];\n }\n if (\"items\" in item || \"autogenerate\" in item) {\n const { link: _link, ...group } = item;\n const children = \"items\" in item ? convert(item.items) : undefined;\n if (children?.length === 0 && !target) return [];\n return [\n {\n ...group,\n label: label(group.label),\n ...(target ? { link: target } : {}),\n ...(\"items\" in item\n ? { items: children! }\n : {\n autogenerate: {\n directory: localePath(item.autogenerate.directory, options),\n },\n }),\n },\n ];\n }\n return target\n ? [{ ...item, label: label(item.label), link: target }]\n : [];\n });\n return {\n layout: {\n ...layout,\n ...(layout.items ? { items: convert(layout.items) } : {}),\n tabs: layout.tabs.map((tab) => ({\n ...tab,\n label: label(tab.label),\n link:\n tab.link.startsWith(\"/\") && !tab.link.startsWith(\"//\")\n ? localePath(tab.link, options)\n : tab.link,\n ...(tab.items ? { items: convert(tab.items) } : {}),\n })),\n },\n routes: localRoutes,\n };\n}\n\nexport const ENGLISH_MESSAGES = {\n copyPage: \"Copy page\",\n viewMarkdown: \"Download Markdown\",\n pageCopied: \"Page copied\",\n pageCopyError: \"Could not copy. Download Markdown to read or copy the text.\",\n draftTitle: \"Draft\",\n draftNotice:\n \"This page is available by direct link and excluded from navigation and indexes.\",\n searchError: \"Search could not load. Close and try again.\",\n appearance: \"Appearance\",\n colorScheme: \"Color scheme\",\n contrast: \"Contrast\",\n normalContrast: \"Normal\",\n highContrast: \"High\",\n auto: \"Auto\",\n closeNavigation: \"Close navigation\",\n primary: \"Primary\",\n sections: \"Sections\",\n chooseSection: \"Choose section\",\n headerLinks: \"Header links\",\n more: \"More\",\n closeMore: \"Close more menu\",\n moreLinks: \"More links\",\n versions: \"Versions\",\n documentationVersion: \"Documentation version\",\n documentationVersions: \"Documentation versions\",\n version: \"Version\",\n home: \"Home\",\n generatedWith: \"Generated with\",\n viewSource: \"View source\",\n copyCode: \"Copy code\",\n codeCopied: \"Code copied\",\n codeCopyError: \"Could not copy code\",\n copyHeading: \"Copy link to “{heading}”\",\n linkCopied: \"Link copied\",\n linkCopyError: \"Could not copy link\",\n notFound: \"Page not found\",\n notFoundDescription: \"The page you requested could not be found.\",\n fallback: \"fallback\",\n} as const;\nexport type MessageKey = keyof typeof ENGLISH_MESSAGES;\nconst FRENCH_MESSAGES: Record<MessageKey, string> = {\n copyPage: \"Copier la page\",\n viewMarkdown: \"Télécharger le Markdown\",\n pageCopied: \"Page copiée\",\n pageCopyError:\n \"Copie impossible. Téléchargez le Markdown pour lire ou copier le texte.\",\n draftTitle: \"Brouillon\",\n draftNotice:\n \"Cette page est accessible par son lien direct et exclue de la navigation et des index.\",\n searchError: \"La recherche n’a pas pu se charger. Fermez et réessayez.\",\n appearance: \"Apparence\",\n colorScheme: \"Thème de couleur\",\n contrast: \"Contraste\",\n normalContrast: \"Normal\",\n highContrast: \"Élevé\",\n auto: \"Auto\",\n closeNavigation: \"Fermer la navigation\",\n primary: \"Navigation principale\",\n sections: \"Sections\",\n chooseSection: \"Choisir une section\",\n headerLinks: \"Liens d’en-tête\",\n more: \"Plus\",\n closeMore: \"Fermer le menu\",\n moreLinks: \"Autres liens\",\n versions: \"Versions\",\n documentationVersion: \"Version de la documentation\",\n documentationVersions: \"Versions de la documentation\",\n version: \"Version\",\n home: \"Accueil\",\n generatedWith: \"Créé avec\",\n viewSource: \"Voir le code source\",\n copyCode: \"Copier le code\",\n codeCopied: \"Code copié\",\n codeCopyError: \"Impossible de copier le code\",\n copyHeading: \"Copier le lien vers « {heading} »\",\n linkCopied: \"Lien copié\",\n linkCopyError: \"Impossible de copier le lien\",\n notFound: \"Page introuvable\",\n notFoundDescription: \"La page demandée est introuvable.\",\n fallback: \"langue de secours\",\n};\nexport function messages(\n lang: string,\n options: LocaleOptions = {},\n): Record<MessageKey, string> {\n const language = lang.split(\"-\")[0] ?? \"en\";\n return {\n ...ENGLISH_MESSAGES,\n ...(language === \"fr\" ? FRENCH_MESSAGES : {}),\n ...options.translations?.[language],\n ...options.translations?.[lang],\n };\n}\n\nexport function localeAlternates(\n path: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n): Array<{ lang: string; route: string }> {\n const available = new Set(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n if (!options.locales || !available.has(path)) return [];\n const alternates = Object.entries(options.locales).flatMap(\n ([locale, config]) => {\n const route = localizedRoute(path, locale, options);\n return available.has(route)\n ? [{ lang: config.lang ?? locale, route }]\n : [];\n },\n );\n const fallback = localizedRoute(\n path,\n options.defaultLocale ??\n (options.locales.root ? \"root\" : Object.keys(options.locales)[0]!),\n options,\n );\n if (available.has(fallback))\n alternates.push({ lang: \"x-default\", route: fallback });\n return alternates;\n}\n"],"mappings":";;AAYA,SAAgB,YAAY,MAAc,SAAgC;CACxE,MAAM,QAAQ,wBAAwB,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;CACvD,OAAO,SAAS,UAAU,UAAU,QAAQ,UAAU,SAAS,QAAQ;AACzE;;AAGA,SAAgB,gBACd,UACA,MACA,SACQ;CACR,MAAM,SAAS,KAAK,QAAQ,OAAO,EAAE;CAKrC,MAAM,SAAS,YAHb,WAAW,aAAa,UAAU,SAAS,WAAW,GAAG,OAAO,EAAE,KAC9D,SAAS,MAAM,OAAO,MAAM,IAC5B,UAC2B,OAAO;CACxC,OAAO,QAAQ,UAAU,OAAO,EAAE,SAAS,WAAW,SAAS,OAAO;AACxE;AAEA,SAAgB,WAAW,MAAc,SAAgC;CACvE,MAAM,QAAQ,wBAAwB,IAAI;CAC1C,MA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D,MAAM,aAAa,OAAO,QAAQ,QAAQ,OAAO,CAAC,CAAC,SAChD,CAAC,QAAQ,YAAY;EACpB,MAAM,QAAQ,eAAe,MAAM,QAAQ,OAAO;EAClD,OAAO,UAAU,IAAI,KAAK,IACtB,CAAC;GAAE,MAAM,OAAO,QAAQ;GAAQ;EAAM,CAAC,IACvC,CAAC;CACP,CACF;CACA,MAAM,WAAW,eACf,MACA,QAAQ,kBACL,QAAQ,QAAQ,OAAO,SAAS,OAAO,KAAK,QAAQ,OAAO,CAAC,CAAC,KAChE,OACF;CACA,IAAI,UAAU,IAAI,QAAQ,GACxB,WAAW,KAAK;EAAE,MAAM;EAAa,OAAO;CAAS,CAAC;CACxD,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"localization.js","names":[],"sources":["../src/localization.ts"],"sourcesContent":["import type { DocsConfig, DocsRoute, NavigationItem } from \"@tenphi/docs\";\nimport {\n normalizeNavigationPath,\n type ResolvedNavigationLayout,\n} from \"./navigation.js\";\n\ntype LocaleOptions = {\n locales?: DocsConfig[\"locales\"] | undefined;\n defaultLocale?: DocsConfig[\"defaultLocale\"] | undefined;\n translations?: DocsConfig[\"translations\"] | undefined;\n};\n\nexport function routeLocale(path: string, options: LocaleOptions): string {\n const first = normalizeNavigationPath(path).split(\"/\")[1];\n return first && first !== \"root\" && options.locales?.[first] ? first : \"root\";\n}\n\n/** Author components can render before the page initializes route locals. */\nexport function requestLanguage(\n pathname: string,\n base: string,\n options: LocaleOptions,\n): string {\n const prefix = base.replace(/\\/$/, \"\");\n const path =\n prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))\n ? pathname.slice(prefix.length)\n : pathname;\n const locale = routeLocale(path, options);\n return options.locales?.[locale]?.lang ?? (locale === \"root\" ? \"en\" : locale);\n}\n\nexport function localePath(path: string, options: LocaleOptions): string {\n const route = normalizeNavigationPath(path);\n const locale = routeLocale(route, options);\n return locale === \"root\"\n ? route\n : normalizeNavigationPath(route.slice(locale.length + 1));\n}\n\nexport function localizedRoute(\n path: string,\n locale: string,\n options: LocaleOptions,\n): string {\n const suffix = localePath(path, options);\n return normalizeNavigationPath(\n `${locale === \"root\" ? \"\" : `/${locale}`}${suffix}`,\n );\n}\n\n/** Missing translations use a real default-language page, then a real locale home. */\nexport function localeTarget(\n path: string,\n locale: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n): string | undefined {\n const visible = new Set(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n const fallback =\n options.defaultLocale ??\n (options.locales?.root\n ? \"root\"\n : (Object.keys(options.locales ?? {})[0] ?? \"root\"));\n return [\n localizedRoute(path, locale, options),\n localizedRoute(path, fallback, options),\n localizedRoute(\"/\", locale, options),\n localizedRoute(\"/\", fallback, options),\n ].find((route) => visible.has(route));\n}\n\nexport function localeHref(\n link: string,\n currentPath: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n base = \"/\",\n): string {\n if (!link.startsWith(\"/\") || link.startsWith(\"//\")) return link;\n const suffix = /[?#].*$/.exec(link)?.[0] ?? \"\";\n const path = suffix ? link.slice(0, -suffix.length) : link;\n const target = options.locales\n ? localeTarget(path, routeLocale(currentPath, options), routes, options)\n : normalizeNavigationPath(path);\n return (\n `${base.replace(/\\/$/, \"\")}${target ?? normalizeNavigationPath(path)}${suffix}` ||\n \"/\"\n );\n}\n\n/** Resolve navigation against the current locale's available routes. */\nexport function localizedNavigation(\n layout: ResolvedNavigationLayout,\n routes: DocsRoute[],\n currentPath: string,\n options: LocaleOptions,\n): { layout: ResolvedNavigationLayout; routes: DocsRoute[] } {\n if (!options.locales) return { layout, routes };\n const locale = routeLocale(currentPath, options);\n const language =\n options.locales[locale]?.lang ?? (locale === \"root\" ? \"en\" : locale);\n const label = (value: string) =>\n options.translations?.[language]?.[`navigation.${value}`] ??\n options.translations?.[language.split(\"-\")[0]!]?.[`navigation.${value}`] ??\n value;\n const localRoutes = routes\n .filter((route) => routeLocale(route.route, options) === locale)\n .map((route) => ({ ...route, route: localePath(route.route, options) }));\n const available = new Set(\n localRoutes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n const visibleRoutes = new Map(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => [route.route, route]),\n );\n const fallbackLocale =\n options.defaultLocale ??\n (options.locales.root ? \"root\" : Object.keys(options.locales)[0]!);\n const convert = (items: NavigationItem[]): NavigationItem[] =>\n items.flatMap((item): NavigationItem[] => {\n const link = typeof item === \"string\" ? item : item.link;\n const internal = link?.startsWith(\"/\") && !link.startsWith(\"//\");\n const translated = internal ? localePath(link!, options) : link;\n const fallback = internal\n ? localizedRoute(link!, fallbackLocale, options)\n : undefined;\n const target =\n !internal || available.has(translated!)\n ? translated\n : fallback && visibleRoutes.has(fallback)\n ? fallback\n : undefined;\n if (typeof item === \"string\") {\n if (!target) return [];\n if (!internal || available.has(translated!)) return [target];\n const route = visibleRoutes.get(target)!;\n return [\n {\n label:\n typeof route.sidebar === \"object\" && route.sidebar.label\n ? route.sidebar.label\n : route.title,\n link: target,\n },\n ];\n }\n if (\"items\" in item || \"autogenerate\" in item) {\n const { link: _link, ...group } = item;\n const children = \"items\" in item ? convert(item.items) : undefined;\n if (children?.length === 0 && !target) return [];\n return [\n {\n ...group,\n label: label(group.label),\n ...(target ? { link: target } : {}),\n ...(\"items\" in item\n ? { items: children! }\n : {\n autogenerate: {\n directory: localePath(item.autogenerate.directory, options),\n },\n }),\n },\n ];\n }\n return target\n ? [{ ...item, label: label(item.label), link: target }]\n : [];\n });\n return {\n layout: {\n ...layout,\n ...(layout.items ? { items: convert(layout.items) } : {}),\n tabs: layout.tabs.map((tab) => ({\n ...tab,\n label: label(tab.label),\n link:\n tab.link.startsWith(\"/\") && !tab.link.startsWith(\"//\")\n ? localePath(tab.link, options)\n : tab.link,\n ...(tab.items ? { items: convert(tab.items) } : {}),\n })),\n },\n routes: localRoutes,\n };\n}\n\nexport { ENGLISH_MESSAGES, messages, type MessageKey } from \"./messages.js\";\n\nexport function localeAlternates(\n path: string,\n routes: DocsRoute[],\n options: LocaleOptions,\n): Array<{ lang: string; route: string }> {\n const available = new Set(\n routes\n .filter((route) => route.discoverable !== false)\n .map((route) => route.route),\n );\n if (!options.locales || !available.has(path)) return [];\n const alternates = Object.entries(options.locales).flatMap(\n ([locale, config]) => {\n const route = localizedRoute(path, locale, options);\n return available.has(route)\n ? [{ lang: config.lang ?? locale, route }]\n : [];\n },\n );\n const fallback = localizedRoute(\n path,\n options.defaultLocale ??\n (options.locales.root ? \"root\" : Object.keys(options.locales)[0]!),\n options,\n );\n if (available.has(fallback))\n alternates.push({ lang: \"x-default\", route: fallback });\n return alternates;\n}\n"],"mappings":";;;AAYA,SAAgB,YAAY,MAAc,SAAgC;CACxE,MAAM,QAAQ,wBAAwB,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;CACvD,OAAO,SAAS,UAAU,UAAU,QAAQ,UAAU,SAAS,QAAQ;AACzE;;AAGA,SAAgB,gBACd,UACA,MACA,SACQ;CACR,MAAM,SAAS,KAAK,QAAQ,OAAO,EAAE;CAKrC,MAAM,SAAS,YAHb,WAAW,aAAa,UAAU,SAAS,WAAW,GAAG,OAAO,EAAE,KAC9D,SAAS,MAAM,OAAO,MAAM,IAC5B,UAC2B,OAAO;CACxC,OAAO,QAAQ,UAAU,OAAO,EAAE,SAAS,WAAW,SAAS,OAAO;AACxE;AAEA,SAAgB,WAAW,MAAc,SAAgC;CACvE,MAAM,QAAQ,wBAAwB,IAAI;CAC1C,MAAM,SAAS,YAAY,OAAO,OAAO;CACzC,OAAO,WAAW,SACd,QACA,wBAAwB,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC;AAC5D;AAEA,SAAgB,eACd,MACA,QACA,SACQ;CACR,MAAM,SAAS,WAAW,MAAM,OAAO;CACvC,OAAO,wBACL,GAAG,WAAW,SAAS,KAAK,IAAI,WAAW,QAC7C;AACF;;AAGA,SAAgB,aACd,MACA,QACA,QACA,SACoB;CACpB,MAAM,UAAU,IAAI,IAClB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CAAC,IACvC,CAAC;CACP,CACF;CACA,MAAM,WAAW,eACf,MACA,QAAQ,kBACL,QAAQ,QAAQ,OAAO,SAAS,OAAO,KAAK,QAAQ,OAAO,CAAC,CAAC,KAChE,OACF;CACA,IAAI,UAAU,IAAI,QAAQ,GACxB,WAAW,KAAK;EAAE,MAAM;EAAa,OAAO;CAAS,CAAC;CACxD,OAAO;AACT"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//#region src/messages.ts
|
|
2
|
+
const ENGLISH_MESSAGES = {
|
|
3
|
+
copyPage: "Copy page",
|
|
4
|
+
viewMarkdown: "Download Markdown",
|
|
5
|
+
pageCopied: "Page copied",
|
|
6
|
+
pageCopyError: "Could not copy. Download Markdown to read or copy the text.",
|
|
7
|
+
draftTitle: "Draft",
|
|
8
|
+
draftNotice: "This page is available by direct link and excluded from navigation and indexes.",
|
|
9
|
+
searchError: "Search could not load. Close and try again.",
|
|
10
|
+
appearance: "Appearance",
|
|
11
|
+
colorScheme: "Color scheme",
|
|
12
|
+
contrast: "Contrast",
|
|
13
|
+
normalContrast: "Normal",
|
|
14
|
+
highContrast: "High",
|
|
15
|
+
auto: "Auto",
|
|
16
|
+
closeNavigation: "Close navigation",
|
|
17
|
+
primary: "Primary",
|
|
18
|
+
sections: "Sections",
|
|
19
|
+
chooseSection: "Choose section",
|
|
20
|
+
headerLinks: "Header links",
|
|
21
|
+
more: "More",
|
|
22
|
+
closeMore: "Close more menu",
|
|
23
|
+
moreLinks: "More links",
|
|
24
|
+
versions: "Versions",
|
|
25
|
+
documentationVersion: "Documentation version",
|
|
26
|
+
documentationVersions: "Documentation versions",
|
|
27
|
+
version: "Version",
|
|
28
|
+
home: "Home",
|
|
29
|
+
generatedWith: "Generated with",
|
|
30
|
+
viewSource: "View source",
|
|
31
|
+
copyCode: "Copy code",
|
|
32
|
+
codeCopied: "Code copied",
|
|
33
|
+
codeCopyError: "Could not copy code",
|
|
34
|
+
copyHeading: "Copy link to “{heading}”",
|
|
35
|
+
linkCopied: "Link copied",
|
|
36
|
+
linkCopyError: "Could not copy link",
|
|
37
|
+
notFound: "Page not found",
|
|
38
|
+
notFoundDescription: "The page you requested could not be found.",
|
|
39
|
+
fallback: "fallback"
|
|
40
|
+
};
|
|
41
|
+
const FRENCH_MESSAGES = {
|
|
42
|
+
copyPage: "Copier la page",
|
|
43
|
+
viewMarkdown: "Télécharger le Markdown",
|
|
44
|
+
pageCopied: "Page copiée",
|
|
45
|
+
pageCopyError: "Copie impossible. Téléchargez le Markdown pour lire ou copier le texte.",
|
|
46
|
+
draftTitle: "Brouillon",
|
|
47
|
+
draftNotice: "Cette page est accessible par son lien direct et exclue de la navigation et des index.",
|
|
48
|
+
searchError: "La recherche n’a pas pu se charger. Fermez et réessayez.",
|
|
49
|
+
appearance: "Apparence",
|
|
50
|
+
colorScheme: "Thème de couleur",
|
|
51
|
+
contrast: "Contraste",
|
|
52
|
+
normalContrast: "Normal",
|
|
53
|
+
highContrast: "Élevé",
|
|
54
|
+
auto: "Auto",
|
|
55
|
+
closeNavigation: "Fermer la navigation",
|
|
56
|
+
primary: "Navigation principale",
|
|
57
|
+
sections: "Sections",
|
|
58
|
+
chooseSection: "Choisir une section",
|
|
59
|
+
headerLinks: "Liens d’en-tête",
|
|
60
|
+
more: "Plus",
|
|
61
|
+
closeMore: "Fermer le menu",
|
|
62
|
+
moreLinks: "Autres liens",
|
|
63
|
+
versions: "Versions",
|
|
64
|
+
documentationVersion: "Version de la documentation",
|
|
65
|
+
documentationVersions: "Versions de la documentation",
|
|
66
|
+
version: "Version",
|
|
67
|
+
home: "Accueil",
|
|
68
|
+
generatedWith: "Créé avec",
|
|
69
|
+
viewSource: "Voir le code source",
|
|
70
|
+
copyCode: "Copier le code",
|
|
71
|
+
codeCopied: "Code copié",
|
|
72
|
+
codeCopyError: "Impossible de copier le code",
|
|
73
|
+
copyHeading: "Copier le lien vers « {heading} »",
|
|
74
|
+
linkCopied: "Lien copié",
|
|
75
|
+
linkCopyError: "Impossible de copier le lien",
|
|
76
|
+
notFound: "Page introuvable",
|
|
77
|
+
notFoundDescription: "La page demandée est introuvable.",
|
|
78
|
+
fallback: "langue de secours"
|
|
79
|
+
};
|
|
80
|
+
const ENGLISH_UI = {
|
|
81
|
+
"sidebarNav.accessibleLabel": "Main navigation",
|
|
82
|
+
"menuButton.accessibleLabel": "Menu",
|
|
83
|
+
"tableOfContents.onThisPage": "On this page",
|
|
84
|
+
"languageSelect.accessibleLabel": "Select language",
|
|
85
|
+
"themeSelect.light": "Light",
|
|
86
|
+
"themeSelect.dark": "Dark",
|
|
87
|
+
"themeSelect.auto": "Auto",
|
|
88
|
+
"search.label": "Search",
|
|
89
|
+
"search.ctrlKey": "Ctrl+",
|
|
90
|
+
"search.cancelLabel": "Cancel",
|
|
91
|
+
"search.devWarning": "Search is available after building the site.",
|
|
92
|
+
"page.nextLink": "Next",
|
|
93
|
+
"page.previousLink": "Previous",
|
|
94
|
+
"page.editLink": "Edit page",
|
|
95
|
+
"page.lastUpdated": "Last updated",
|
|
96
|
+
"page.skipToContent": "Skip to content",
|
|
97
|
+
"pagefind.search": "Search for",
|
|
98
|
+
"pagefind.clear_search": "Clear search",
|
|
99
|
+
"pagefind.zero_results": "No results",
|
|
100
|
+
"pagefind.many_results": "[COUNT] results",
|
|
101
|
+
"pagefind.one_result": "[COUNT] result"
|
|
102
|
+
};
|
|
103
|
+
const FRENCH_UI = {
|
|
104
|
+
"sidebarNav.accessibleLabel": "Navigation principale",
|
|
105
|
+
"menuButton.accessibleLabel": "Menu",
|
|
106
|
+
"tableOfContents.onThisPage": "Sur cette page",
|
|
107
|
+
"languageSelect.accessibleLabel": "Choisir la langue",
|
|
108
|
+
"themeSelect.light": "Clair",
|
|
109
|
+
"themeSelect.dark": "Sombre",
|
|
110
|
+
"themeSelect.auto": "Auto",
|
|
111
|
+
"search.label": "Rechercher",
|
|
112
|
+
"search.cancelLabel": "Annuler",
|
|
113
|
+
"search.devWarning": "La recherche est disponible après la génération du site.",
|
|
114
|
+
"pagefind.search": "Rechercher",
|
|
115
|
+
"pagefind.clear_search": "Effacer la recherche",
|
|
116
|
+
"pagefind.zero_results": "Aucun résultat",
|
|
117
|
+
"pagefind.many_results": "[COUNT] résultats",
|
|
118
|
+
"pagefind.one_result": "[COUNT] résultat",
|
|
119
|
+
"page.nextLink": "Suivant",
|
|
120
|
+
"page.previousLink": "Précédent",
|
|
121
|
+
"page.editLink": "Modifier la page",
|
|
122
|
+
"page.lastUpdated": "Dernière mise à jour",
|
|
123
|
+
"page.skipToContent": "Aller au contenu"
|
|
124
|
+
};
|
|
125
|
+
function resolveTranslations(english, french, lang, options) {
|
|
126
|
+
const language = lang.split("-")[0] ?? "en";
|
|
127
|
+
return {
|
|
128
|
+
...english,
|
|
129
|
+
...language === "fr" ? french : {},
|
|
130
|
+
...options.translations?.[language],
|
|
131
|
+
...options.translations?.[lang]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function messages(lang, options = {}) {
|
|
135
|
+
return resolveTranslations(ENGLISH_MESSAGES, FRENCH_MESSAGES, lang, options);
|
|
136
|
+
}
|
|
137
|
+
function uiTranslations(lang, options) {
|
|
138
|
+
return resolveTranslations(ENGLISH_UI, FRENCH_UI, lang, options);
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { messages as n, uiTranslations as r, ENGLISH_MESSAGES as t };
|
|
142
|
+
|
|
143
|
+
//# sourceMappingURL=messages-BqBGDIoP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-BqBGDIoP.js","names":[],"sources":["../src/messages.ts"],"sourcesContent":["import type { DocsConfig } from \"@tenphi/docs\";\n\ntype MessageOptions = {\n locales?: DocsConfig[\"locales\"] | undefined;\n defaultLocale?: DocsConfig[\"defaultLocale\"] | undefined;\n translations?: DocsConfig[\"translations\"] | undefined;\n};\n\nexport const ENGLISH_MESSAGES = {\n copyPage: \"Copy page\",\n viewMarkdown: \"Download Markdown\",\n pageCopied: \"Page copied\",\n pageCopyError: \"Could not copy. Download Markdown to read or copy the text.\",\n draftTitle: \"Draft\",\n draftNotice:\n \"This page is available by direct link and excluded from navigation and indexes.\",\n searchError: \"Search could not load. Close and try again.\",\n appearance: \"Appearance\",\n colorScheme: \"Color scheme\",\n contrast: \"Contrast\",\n normalContrast: \"Normal\",\n highContrast: \"High\",\n auto: \"Auto\",\n closeNavigation: \"Close navigation\",\n primary: \"Primary\",\n sections: \"Sections\",\n chooseSection: \"Choose section\",\n headerLinks: \"Header links\",\n more: \"More\",\n closeMore: \"Close more menu\",\n moreLinks: \"More links\",\n versions: \"Versions\",\n documentationVersion: \"Documentation version\",\n documentationVersions: \"Documentation versions\",\n version: \"Version\",\n home: \"Home\",\n generatedWith: \"Generated with\",\n viewSource: \"View source\",\n copyCode: \"Copy code\",\n codeCopied: \"Code copied\",\n codeCopyError: \"Could not copy code\",\n copyHeading: \"Copy link to “{heading}”\",\n linkCopied: \"Link copied\",\n linkCopyError: \"Could not copy link\",\n notFound: \"Page not found\",\n notFoundDescription: \"The page you requested could not be found.\",\n fallback: \"fallback\",\n} as const;\nexport type MessageKey = keyof typeof ENGLISH_MESSAGES;\nconst FRENCH_MESSAGES: Record<MessageKey, string> = {\n copyPage: \"Copier la page\",\n viewMarkdown: \"Télécharger le Markdown\",\n pageCopied: \"Page copiée\",\n pageCopyError:\n \"Copie impossible. Téléchargez le Markdown pour lire ou copier le texte.\",\n draftTitle: \"Brouillon\",\n draftNotice:\n \"Cette page est accessible par son lien direct et exclue de la navigation et des index.\",\n searchError: \"La recherche n’a pas pu se charger. Fermez et réessayez.\",\n appearance: \"Apparence\",\n colorScheme: \"Thème de couleur\",\n contrast: \"Contraste\",\n normalContrast: \"Normal\",\n highContrast: \"Élevé\",\n auto: \"Auto\",\n closeNavigation: \"Fermer la navigation\",\n primary: \"Navigation principale\",\n sections: \"Sections\",\n chooseSection: \"Choisir une section\",\n headerLinks: \"Liens d’en-tête\",\n more: \"Plus\",\n closeMore: \"Fermer le menu\",\n moreLinks: \"Autres liens\",\n versions: \"Versions\",\n documentationVersion: \"Version de la documentation\",\n documentationVersions: \"Versions de la documentation\",\n version: \"Version\",\n home: \"Accueil\",\n generatedWith: \"Créé avec\",\n viewSource: \"Voir le code source\",\n copyCode: \"Copier le code\",\n codeCopied: \"Code copié\",\n codeCopyError: \"Impossible de copier le code\",\n copyHeading: \"Copier le lien vers « {heading} »\",\n linkCopied: \"Lien copié\",\n linkCopyError: \"Impossible de copier le lien\",\n notFound: \"Page introuvable\",\n notFoundDescription: \"La page demandée est introuvable.\",\n fallback: \"langue de secours\",\n};\n\nconst ENGLISH_UI = {\n \"sidebarNav.accessibleLabel\": \"Main navigation\",\n \"menuButton.accessibleLabel\": \"Menu\",\n \"tableOfContents.onThisPage\": \"On this page\",\n \"languageSelect.accessibleLabel\": \"Select language\",\n \"themeSelect.light\": \"Light\",\n \"themeSelect.dark\": \"Dark\",\n \"themeSelect.auto\": \"Auto\",\n \"search.label\": \"Search\",\n \"search.ctrlKey\": \"Ctrl+\",\n \"search.cancelLabel\": \"Cancel\",\n \"search.devWarning\": \"Search is available after building the site.\",\n \"page.nextLink\": \"Next\",\n \"page.previousLink\": \"Previous\",\n \"page.editLink\": \"Edit page\",\n \"page.lastUpdated\": \"Last updated\",\n \"page.skipToContent\": \"Skip to content\",\n \"pagefind.search\": \"Search for\",\n \"pagefind.clear_search\": \"Clear search\",\n \"pagefind.zero_results\": \"No results\",\n \"pagefind.many_results\": \"[COUNT] results\",\n \"pagefind.one_result\": \"[COUNT] result\",\n} as const;\n\nconst FRENCH_UI: Partial<Record<keyof typeof ENGLISH_UI, string>> = {\n \"sidebarNav.accessibleLabel\": \"Navigation principale\",\n \"menuButton.accessibleLabel\": \"Menu\",\n \"tableOfContents.onThisPage\": \"Sur cette page\",\n \"languageSelect.accessibleLabel\": \"Choisir la langue\",\n \"themeSelect.light\": \"Clair\",\n \"themeSelect.dark\": \"Sombre\",\n \"themeSelect.auto\": \"Auto\",\n \"search.label\": \"Rechercher\",\n \"search.cancelLabel\": \"Annuler\",\n \"search.devWarning\":\n \"La recherche est disponible après la génération du site.\",\n \"pagefind.search\": \"Rechercher\",\n \"pagefind.clear_search\": \"Effacer la recherche\",\n \"pagefind.zero_results\": \"Aucun résultat\",\n \"pagefind.many_results\": \"[COUNT] résultats\",\n \"pagefind.one_result\": \"[COUNT] résultat\",\n \"page.nextLink\": \"Suivant\",\n \"page.previousLink\": \"Précédent\",\n \"page.editLink\": \"Modifier la page\",\n \"page.lastUpdated\": \"Dernière mise à jour\",\n \"page.skipToContent\": \"Aller au contenu\",\n};\n\n// The two key namespaces remain independent compatibility views of one owner.\nfunction resolveTranslations<Key extends string>(\n english: Record<Key, string>,\n french: Partial<Record<Key, string>>,\n lang: string,\n options: Pick<MessageOptions, \"translations\">,\n): Record<Key, string> {\n const language = lang.split(\"-\")[0] ?? \"en\";\n return {\n ...english,\n ...(language === \"fr\" ? french : {}),\n ...options.translations?.[language],\n ...options.translations?.[lang],\n };\n}\n\nexport function messages(\n lang: string,\n options: MessageOptions = {},\n): Record<MessageKey, string> {\n return resolveTranslations(ENGLISH_MESSAGES, FRENCH_MESSAGES, lang, options);\n}\n\nexport function uiTranslations(\n lang: string,\n options: Pick<DocsConfig, \"translations\">,\n): Record<string, string> {\n return resolveTranslations(ENGLISH_UI, FRENCH_UI, lang, options);\n}\n"],"mappings":";AAQA,MAAa,mBAAmB;CAC9B,UAAU;CACV,cAAc;CACd,YAAY;CACZ,eAAe;CACf,YAAY;CACZ,aACE;CACF,aAAa;CACb,YAAY;CACZ,aAAa;CACb,UAAU;CACV,gBAAgB;CAChB,cAAc;CACd,MAAM;CACN,iBAAiB;CACjB,SAAS;CACT,UAAU;CACV,eAAe;CACf,aAAa;CACb,MAAM;CACN,WAAW;CACX,WAAW;CACX,UAAU;CACV,sBAAsB;CACtB,uBAAuB;CACvB,SAAS;CACT,MAAM;CACN,eAAe;CACf,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,eA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KAAK,MAAM,GAAG,CAAC,CAAC,MAAM;CACvC,OAAO;EACL,GAAG;EACH,GAAI,aAAa,OAAO,SAAS,CAAC;EAClC,GAAG,QAAQ,eAAe;EAC1B,GAAG,QAAQ,eAAe;CAC5B;AACF;AAEA,SAAgB,SACd,MACA,UAA0B,CAAC,GACC;CAC5B,OAAO,oBAAoB,kBAAkB,iBAAiB,MAAM,OAAO;AAC7E;AAEA,SAAgB,eACd,MACA,SACwB;CACxB,OAAO,oBAAoB,YAAY,WAAW,MAAM,OAAO;AACjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DocsConfig } from "@tenphi/docs";
|
|
2
|
+
//#region src/messages.d.ts
|
|
3
|
+
type MessageOptions = {
|
|
4
|
+
locales?: DocsConfig["locales"] | undefined;
|
|
5
|
+
defaultLocale?: DocsConfig["defaultLocale"] | undefined;
|
|
6
|
+
translations?: DocsConfig["translations"] | undefined;
|
|
7
|
+
};
|
|
8
|
+
declare const ENGLISH_MESSAGES: {
|
|
9
|
+
readonly copyPage: "Copy page";
|
|
10
|
+
readonly viewMarkdown: "Download Markdown";
|
|
11
|
+
readonly pageCopied: "Page copied";
|
|
12
|
+
readonly pageCopyError: "Could not copy. Download Markdown to read or copy the text.";
|
|
13
|
+
readonly draftTitle: "Draft";
|
|
14
|
+
readonly draftNotice: "This page is available by direct link and excluded from navigation and indexes.";
|
|
15
|
+
readonly searchError: "Search could not load. Close and try again.";
|
|
16
|
+
readonly appearance: "Appearance";
|
|
17
|
+
readonly colorScheme: "Color scheme";
|
|
18
|
+
readonly contrast: "Contrast";
|
|
19
|
+
readonly normalContrast: "Normal";
|
|
20
|
+
readonly highContrast: "High";
|
|
21
|
+
readonly auto: "Auto";
|
|
22
|
+
readonly closeNavigation: "Close navigation";
|
|
23
|
+
readonly primary: "Primary";
|
|
24
|
+
readonly sections: "Sections";
|
|
25
|
+
readonly chooseSection: "Choose section";
|
|
26
|
+
readonly headerLinks: "Header links";
|
|
27
|
+
readonly more: "More";
|
|
28
|
+
readonly closeMore: "Close more menu";
|
|
29
|
+
readonly moreLinks: "More links";
|
|
30
|
+
readonly versions: "Versions";
|
|
31
|
+
readonly documentationVersion: "Documentation version";
|
|
32
|
+
readonly documentationVersions: "Documentation versions";
|
|
33
|
+
readonly version: "Version";
|
|
34
|
+
readonly home: "Home";
|
|
35
|
+
readonly generatedWith: "Generated with";
|
|
36
|
+
readonly viewSource: "View source";
|
|
37
|
+
readonly copyCode: "Copy code";
|
|
38
|
+
readonly codeCopied: "Code copied";
|
|
39
|
+
readonly codeCopyError: "Could not copy code";
|
|
40
|
+
readonly copyHeading: "Copy link to “{heading}”";
|
|
41
|
+
readonly linkCopied: "Link copied";
|
|
42
|
+
readonly linkCopyError: "Could not copy link";
|
|
43
|
+
readonly notFound: "Page not found";
|
|
44
|
+
readonly notFoundDescription: "The page you requested could not be found.";
|
|
45
|
+
readonly fallback: "fallback";
|
|
46
|
+
};
|
|
47
|
+
type MessageKey = keyof typeof ENGLISH_MESSAGES;
|
|
48
|
+
declare function messages(lang: string, options?: MessageOptions): Record<MessageKey, string>;
|
|
49
|
+
declare function uiTranslations(lang: string, options: Pick<DocsConfig, "translations">): Record<string, string>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { uiTranslations as i, MessageKey as n, messages as r, ENGLISH_MESSAGES as t };
|
|
52
|
+
//# sourceMappingURL=messages-ClTf2nFf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-ClTf2nFf.d.ts","names":[],"sources":["../src/messages.ts"],"mappings":";;KAEK;EACH,UAAU;EACV,gBAAgB;EAChB,eAAe;;cAGJ;WACX;WACA;WACA;WACA;WACA;WACA;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;KAEU,0BAA0B;iBA2GtB,SACd,cACA,UAAS,iBACR,OAAO;iBAIM,eACd,cACA,SAAS,KAAK,8BACb"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ENGLISH_MESSAGES } from "./
|
|
1
|
+
import { t as ENGLISH_MESSAGES } from "./messages-BqBGDIoP.js";
|
|
2
2
|
//#region src/client/messages.ts
|
|
3
3
|
function message(key) {
|
|
4
4
|
try {
|
|
@@ -11,4 +11,4 @@ function message(key) {
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { message as t };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=messages-
|
|
14
|
+
//# sourceMappingURL=messages-bS8G9Pj8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-
|
|
1
|
+
{"version":3,"file":"messages-bS8G9Pj8.js","names":[],"sources":["../src/client/messages.ts"],"sourcesContent":["import { ENGLISH_MESSAGES, type MessageKey } from \"../localization.js\";\nexport function message(key: MessageKey): string {\n try {\n const custom = JSON.parse(\n document\n .querySelector('meta[name=\"cookbook-messages\"]')\n ?.getAttribute(\"content\") ?? \"{}\",\n );\n return typeof custom[key] === \"string\"\n ? custom[key]\n : ENGLISH_MESSAGES[key];\n } catch {\n return ENGLISH_MESSAGES[key];\n }\n}\n"],"mappings":";;AACA,SAAgB,QAAQ,KAAyB;CAC/C,IAAI;EACF,MAAM,SAAS,KAAK,MAClB,SACG,cAAc,kCAAgC,CAAC,EAC9C,aAAa,SAAS,KAAK,IACjC;EACA,OAAO,OAAO,OAAO,SAAS,WAC1B,OAAO,OACP,iBAAiB;CACvB,QAAQ;EACN,OAAO,iBAAiB;CAC1B;AACF"}
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare function uiTranslations(lang: string, options: Pick<DocsConfig, "translations">): Record<string, string>;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { uiTranslations };
|
|
6
|
-
//# sourceMappingURL=ui.d.ts.map
|
|
1
|
+
import { i as uiTranslations } from "./messages-ClTf2nFf.js";
|
|
2
|
+
export { uiTranslations };
|
package/dist/ui.js
CHANGED
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const english = {
|
|
3
|
-
"sidebarNav.accessibleLabel": "Main navigation",
|
|
4
|
-
"menuButton.accessibleLabel": "Menu",
|
|
5
|
-
"tableOfContents.onThisPage": "On this page",
|
|
6
|
-
"languageSelect.accessibleLabel": "Select language",
|
|
7
|
-
"themeSelect.light": "Light",
|
|
8
|
-
"themeSelect.dark": "Dark",
|
|
9
|
-
"themeSelect.auto": "Auto",
|
|
10
|
-
"search.label": "Search",
|
|
11
|
-
"search.ctrlKey": "Ctrl+",
|
|
12
|
-
"search.cancelLabel": "Cancel",
|
|
13
|
-
"search.devWarning": "Search is available after building the site.",
|
|
14
|
-
"page.nextLink": "Next",
|
|
15
|
-
"page.previousLink": "Previous",
|
|
16
|
-
"page.editLink": "Edit page",
|
|
17
|
-
"page.lastUpdated": "Last updated",
|
|
18
|
-
"page.skipToContent": "Skip to content",
|
|
19
|
-
"pagefind.search": "Search for",
|
|
20
|
-
"pagefind.clear_search": "Clear search",
|
|
21
|
-
"pagefind.zero_results": "No results",
|
|
22
|
-
"pagefind.many_results": "[COUNT] results",
|
|
23
|
-
"pagefind.one_result": "[COUNT] result"
|
|
24
|
-
};
|
|
25
|
-
const french = {
|
|
26
|
-
"sidebarNav.accessibleLabel": "Navigation principale",
|
|
27
|
-
"menuButton.accessibleLabel": "Menu",
|
|
28
|
-
"tableOfContents.onThisPage": "Sur cette page",
|
|
29
|
-
"languageSelect.accessibleLabel": "Choisir la langue",
|
|
30
|
-
"themeSelect.light": "Clair",
|
|
31
|
-
"themeSelect.dark": "Sombre",
|
|
32
|
-
"themeSelect.auto": "Auto",
|
|
33
|
-
"search.label": "Rechercher",
|
|
34
|
-
"search.cancelLabel": "Annuler",
|
|
35
|
-
"search.devWarning": "La recherche est disponible après la génération du site.",
|
|
36
|
-
"pagefind.search": "Rechercher",
|
|
37
|
-
"pagefind.clear_search": "Effacer la recherche",
|
|
38
|
-
"pagefind.zero_results": "Aucun résultat",
|
|
39
|
-
"pagefind.many_results": "[COUNT] résultats",
|
|
40
|
-
"pagefind.one_result": "[COUNT] résultat",
|
|
41
|
-
"page.nextLink": "Suivant",
|
|
42
|
-
"page.previousLink": "Précédent",
|
|
43
|
-
"page.editLink": "Modifier la page",
|
|
44
|
-
"page.lastUpdated": "Dernière mise à jour",
|
|
45
|
-
"page.skipToContent": "Aller au contenu"
|
|
46
|
-
};
|
|
47
|
-
function uiTranslations(lang, options) {
|
|
48
|
-
const language = lang.split("-")[0] ?? "en";
|
|
49
|
-
return {
|
|
50
|
-
...english,
|
|
51
|
-
...language === "fr" ? french : {},
|
|
52
|
-
...options.translations?.[language],
|
|
53
|
-
...options.translations?.[lang]
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
1
|
+
import { r as uiTranslations } from "./messages-BqBGDIoP.js";
|
|
57
2
|
export { uiTranslations };
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=ui.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/renderer",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"description": "Astro renderer and Tasty theme for Cookbook",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
62
62
|
"@fontsource-variable/onest": "^5.3.0",
|
|
63
63
|
"@pagefind/default-ui": "1.5.2",
|
|
64
|
-
"@tenphi/docs": "0.21.
|
|
64
|
+
"@tenphi/docs": "0.21.4",
|
|
65
65
|
"@tenphi/eslint-plugin-tasty": "1.5.1",
|
|
66
66
|
"@tenphi/glaze": "2.0.0",
|
|
67
67
|
"@tenphi/tasty": "3.9.6",
|
package/dist/ui.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","names":[],"sources":["../src/ui.ts"],"mappings":";;iBAkDgB,eACd,cACA,SAAS,KAAK,8BACb"}
|
package/dist/ui.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","names":[],"sources":["../src/ui.ts"],"sourcesContent":["import type { DocsConfig } from \"@tenphi/docs\";\n\nconst english: Record<string, string> = {\n \"sidebarNav.accessibleLabel\": \"Main navigation\",\n \"menuButton.accessibleLabel\": \"Menu\",\n \"tableOfContents.onThisPage\": \"On this page\",\n \"languageSelect.accessibleLabel\": \"Select language\",\n \"themeSelect.light\": \"Light\",\n \"themeSelect.dark\": \"Dark\",\n \"themeSelect.auto\": \"Auto\",\n \"search.label\": \"Search\",\n \"search.ctrlKey\": \"Ctrl+\",\n \"search.cancelLabel\": \"Cancel\",\n \"search.devWarning\": \"Search is available after building the site.\",\n \"page.nextLink\": \"Next\",\n \"page.previousLink\": \"Previous\",\n \"page.editLink\": \"Edit page\",\n \"page.lastUpdated\": \"Last updated\",\n \"page.skipToContent\": \"Skip to content\",\n \"pagefind.search\": \"Search for\",\n \"pagefind.clear_search\": \"Clear search\",\n \"pagefind.zero_results\": \"No results\",\n \"pagefind.many_results\": \"[COUNT] results\",\n \"pagefind.one_result\": \"[COUNT] result\",\n};\n\nconst french: Record<string, string> = {\n \"sidebarNav.accessibleLabel\": \"Navigation principale\",\n \"menuButton.accessibleLabel\": \"Menu\",\n \"tableOfContents.onThisPage\": \"Sur cette page\",\n \"languageSelect.accessibleLabel\": \"Choisir la langue\",\n \"themeSelect.light\": \"Clair\",\n \"themeSelect.dark\": \"Sombre\",\n \"themeSelect.auto\": \"Auto\",\n \"search.label\": \"Rechercher\",\n \"search.cancelLabel\": \"Annuler\",\n \"search.devWarning\":\n \"La recherche est disponible après la génération du site.\",\n \"pagefind.search\": \"Rechercher\",\n \"pagefind.clear_search\": \"Effacer la recherche\",\n \"pagefind.zero_results\": \"Aucun résultat\",\n \"pagefind.many_results\": \"[COUNT] résultats\",\n \"pagefind.one_result\": \"[COUNT] résultat\",\n \"page.nextLink\": \"Suivant\",\n \"page.previousLink\": \"Précédent\",\n \"page.editLink\": \"Modifier la page\",\n \"page.lastUpdated\": \"Dernière mise à jour\",\n \"page.skipToContent\": \"Aller au contenu\",\n};\n\nexport function uiTranslations(\n lang: string,\n options: Pick<DocsConfig, \"translations\">,\n): Record<string, string> {\n const language = lang.split(\"-\")[0] ?? \"en\";\n return {\n ...english,\n ...(language === \"fr\" ? french : {}),\n ...options.translations?.[language],\n ...options.translations?.[lang],\n };\n}\n"],"mappings":";AAEA,MAAM,UAAkC;CACtC,8BAA8B;CAC9B,8BAA8B;CAC9B,8BAA8B;CAC9B,kCAAkC;CAClC,qBAAqB;CACrB,oBAAoB;CACpB,oBAAoB;CACpB,gBAAgB;CAChB,kBAAkB;CAClB,sBAAsB;CACtB,qBAAqB;CACrB,iBAAiB;CACjB,qBAAqB;CACrB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;CACtB,mBAAmB;CACnB,yBAAyB;CACzB,yBAAyB;CACzB,yBAAyB;CACzB,uBAAuB;AACzB;AAEA,MAAM,SAAiC;CACrC,8BAA8B;CAC9B,8BAA8B;CAC9B,8BAA8B;CAC9B,kCAAkC;CAClC,qBAAqB;CACrB,oBAAoB;CACpB,oBAAoB;CACpB,gBAAgB;CAChB,sBAAsB;CACtB,qBACE;CACF,mBAAmB;CACnB,yBAAyB;CACzB,yBAAyB;CACzB,yBAAyB;CACzB,uBAAuB;CACvB,iBAAiB;CACjB,qBAAqB;CACrB,iBAAiB;CACjB,oBAAoB;CACpB,sBAAsB;AACxB;AAEA,SAAgB,eACd,MACA,SACwB;CACxB,MAAM,WAAW,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM;CACvC,OAAO;EACL,GAAG;EACH,GAAI,aAAa,OAAO,SAAS,CAAC;EAClC,GAAG,QAAQ,eAAe;EAC1B,GAAG,QAAQ,eAAe;CAC5B;AACF"}
|