1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 dictionary FluentTextElementItem {
12 [ChromeOnly, Exposed=Window]
13 interface FluentResource {
14 constructor(UTF8String source);
17 sequence<FluentTextElementItem> textElements();
20 [ChromeOnly, Exposed=Window]
21 interface FluentPattern {};
24 * FluentMessage is a structure storing an unresolved L10nMessage,
25 * as returned by the Fluent Bundle.
27 * It stores a FluentPattern of the value and attributes, which
28 * can be then passed to bundle.formatPattern.
31 dictionary FluentMessage {
32 FluentPattern? value = null;
33 required record<UTF8String, FluentPattern> attributes;
36 typedef record<UTF8String, (UTF8String or double)?> L10nArgs;
38 dictionary FluentBundleOptions {
39 boolean useIsolating = false;
40 UTF8String pseudoStrategy;
43 dictionary FluentBundleAddResourceOptions {
44 boolean allowOverrides = false;
47 [ChromeOnly, Exposed=Window]
48 interface FluentBundle {
50 constructor((UTF8String or sequence<UTF8String>) aLocales, optional FluentBundleOptions aOptions = {});
53 readonly attribute sequence<UTF8String> locales;
55 undefined addResource(FluentResource aResource, optional FluentBundleAddResourceOptions aOptions = {});
56 boolean hasMessage(UTF8String id);
57 FluentMessage? getMessage(UTF8String id);
59 UTF8String formatPattern(FluentPattern pattern, optional L10nArgs? aArgs = null, optional object aErrors);