Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / IntlUtils.webidl
blob1efa35c72877c52346354d6ebbc215829f0e2855
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 [GenerateConversionToJS]
6 dictionary DisplayNameOptions {
7   DOMString type;
8   DOMString style;
9   DOMString calendar;
10   sequence<DOMString> keys;
13 [GenerateInit]
14 dictionary DisplayNameResult {
15   DOMString locale;
16   DOMString type;
17   DOMString style;
18   DOMString calendar;
19   sequence<DOMString> values;
22 [GenerateInit]
23 dictionary LocaleInfo {
24   DOMString locale;
25   DOMString direction;
28 /**
29  * The IntlUtils interface provides helper functions for localization.
30  */
31 [LegacyNoInterfaceObject,
32  Exposed=Window]
33 interface IntlUtils {
34   /**
35    * Helper function to retrieve the localized values for a list of requested
36    * keys.
37    *
38    * The function takes two arguments - locales which is a list of locale
39    * strings and options which is an object with four optional properties:
40    *
41    *   keys:
42    *     an Array of string values to localize
43    *
44    *   type:
45    *     a String with a value "language", "region", "script", "currency",
46    *     "weekday", "month", "quarter", "dayPeriod", or "dateTimeField"
47    *
48    *   style:
49    *     a String with a value "long", "abbreviated", "short", or "narrow"
50    *
51    *   calendar:
52    *     a String to select a specific calendar type, e.g. "gregory"
53    *
54    * It returns an object with properties:
55    *
56    *   locale:
57    *     a negotiated locale string
58    *
59    *   type:
60    *     negotiated type
61    *
62    *   style:
63    *     negotiated style
64    *
65    *   calendar:
66    *     negotiated calendar
67    *
68    *   values:
69    *     a list of translated values for the requested keys
70    *
71    */
72   [Throws]
73   DisplayNameResult getDisplayNames(sequence<DOMString> locales,
74                                     optional DisplayNameOptions options = {});
76   /**
77    * Helper function to determine if the current application locale is RTL.
78    *
79    * The result of this function can be overriden by this pref:
80    *  - `intl.l10n.pseudo`
81    */
82   boolean isAppLocaleRTL();