UNPKG

@inlang/paraglide-js

Version:

[![NPM Downloads](https://img.shields.io/npm/dw/%40inlang%2Fparaglide-js?logo=npm&logoColor=red&label=npm%20downloads)](https://www.npmjs.com/package/@inlang/paraglide-js) [![GitHub Issues](https://img.shields.io/github/issues-closed/opral/paraglide-js?lo

30 lines 1.06 kB
import type { Declaration, Pattern } from "@inlang/sdk"; import type { Compiled } from "./types.js"; export type CompilePatternMode = "string" | "parts"; /** * Compiles a pattern into either a template literal string or parts array. * * @example * const pattern: Pattern = [ * { type: "text", value: "Your age is " }, * { type: "expression", arg: { type: "variable-reference", name: "age" } }, * ] * * const { code } = compilePattern({ pattern, declarations: [{ type: "input-variable", name: "age" }] }); * * // code will be: `Your age is ${i?.age}` */ export declare const compilePattern: (args: { pattern: Pattern; declarations: Declaration[]; mode?: CompilePatternMode; /** * The locale of the message the pattern belongs to. * * Required to compile expressions with annotations like * `{ annotation: { type: "function-reference", name: "number" } }` * into `registry.number(locale, ...)` calls. */ locale?: string; }) => Compiled<Pattern>; //# sourceMappingURL=compile-pattern.d.ts.map