@inlang/paraglide-js
Advanced tools
Comparing version 1.6.0 to 1.6.1
export { negotiateLanguagePreferences } from './negotiation/language.js'; | ||
export { detectLanguageFromPath } from './routing/detectLanguage.js'; | ||
export { bestMatch, resolveRoute, parseRouteDefinition, exec, type PathDefinitionTranslations, type ParamMatcher, type RouteParam, } from './routing/routeDefinitions.js'; | ||
export { validatePathTranslations, prettyPrintIssues } from './routing/validatePathTranslations.js'; | ||
export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from './routing/validatePathTranslations.js'; | ||
export { resolveUserPathDefinitions, type UserPathDefinitionTranslations, } from './routing/resolveUserPathDefinitions.js'; |
@@ -363,5 +363,14 @@ function negotiateLanguagePreferences(accept, availableLanguageTags) { | ||
} | ||
function prettyPrintIssues(issues) { | ||
function prettyPrintPathDefinitionIssues(issues) { | ||
return issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n"); | ||
} | ||
const resolveUserPathDefinitions = (userTranslations, availableLanguageTags) => Object.fromEntries( | ||
Object.entries(userTranslations).map(([path, translation]) => [ | ||
path, | ||
typeof translation === "object" ? translation : fromMessage(translation, availableLanguageTags) | ||
]) | ||
); | ||
const fromMessage = (message, availableLanguageTags) => Object.fromEntries( | ||
availableLanguageTags.map((languageTag) => [languageTag, message({}, { languageTag })]) | ||
); | ||
export { | ||
@@ -373,5 +382,6 @@ bestMatch, | ||
parseRouteDefinition, | ||
prettyPrintIssues, | ||
prettyPrintPathDefinitionIssues, | ||
resolveRoute, | ||
resolveUserPathDefinitions, | ||
validatePathTranslations | ||
}; |
@@ -11,2 +11,6 @@ /** | ||
* /base/de/ueber-uns -> de | ||
* | ||
* /base/about -> undefined because it does not explicitly include the language | ||
* /en/about -> undefined because the path is not in the base | ||
* | ||
* @returns the language tag if present | ||
@@ -13,0 +17,0 @@ * |
@@ -15,2 +15,2 @@ import { ParamMatcher, PathDefinitionTranslations } from './routeDefinitions.js'; | ||
*/ | ||
export declare function prettyPrintIssues(issues: PathTranslationIssue[]): string; | ||
export declare function prettyPrintPathDefinitionIssues(issues: PathTranslationIssue[]): string; |
@@ -5,5 +5,5 @@ export { cli } from './cli/main.js'; | ||
export { Logger, type LoggerOptions } from './services/logger/index.js'; | ||
export type MessageIndexFunction<T extends string> = (params?: Record<string, never>, options?: { | ||
export type MessageIndexFunction<T extends string> = (params: Record<string, never>, options: { | ||
languageTag: T; | ||
}) => string; | ||
export type MessageFunction = (params?: Record<string, never>) => string; |
{ | ||
"name": "@inlang/paraglide-js", | ||
"type": "module", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"license": "Apache-2.0", | ||
@@ -65,10 +65,10 @@ "publishConfig": { | ||
"vitest": "0.34.3", | ||
"@inlang/env-variables": "0.2.0", | ||
"@inlang/cross-sell-sherlock": "0.0.4", | ||
"@inlang/env-variables": "0.2.0", | ||
"@inlang/language-tag": "1.5.1", | ||
"@inlang/sdk": "0.32.0", | ||
"@inlang/plugin-message-format": "2.1.1", | ||
"@inlang/telemetry": "0.3.22", | ||
"@lix-js/client": "1.2.0", | ||
"@lix-js/fs": "1.0.0", | ||
"@inlang/sdk": "0.32.0" | ||
"@inlang/telemetry": "0.3.22" | ||
}, | ||
@@ -75,0 +75,0 @@ "exports": { |
Sorry, the diff of this file is too big to display
1660250
61
48815