@fluent/bundle
Version:
Localization library for expressive translations.
27 lines (26 loc) • 1.37 kB
TypeScript
/**
* The role of the Fluent resolver is to format a `Pattern` to an instance of
* `FluentValue`. For performance reasons, primitive strings are considered
* such instances, too.
*
* Translations can contain references to other messages or variables,
* conditional logic in form of select expressions, traits which describe their
* grammatical features, and can use Fluent builtins which make use of the
* `Intl` formatters to format numbers and dates into the bundle's languages.
* See the documentation of the Fluent syntax for more information.
*
* In case of errors the resolver will try to salvage as much of the
* translation as possible. In rare situations where the resolver didn't know
* how to recover from an error it will return an instance of `FluentNone`.
*
* All expressions resolve to an instance of `FluentValue`. The caller should
* use the `toString` method to convert the instance to a native value.
*
* Functions in this file pass around an instance of the `Scope` class, which
* stores the data required for successful resolution and error recovery.
*/
import { FluentValue } from "./types.js";
import { Scope } from "./scope.js";
import { ComplexPattern } from "./ast.js";
/** Resolve a pattern (a complex string with placeables). */
export declare function resolveComplexPattern(scope: Scope, ptn: ComplexPattern): FluentValue;