tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mozIOSPreferences.idl (3374B)


      1 /* -*- Mode: IDL; 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/. */
      5 
      6 #include "nsISupports.idl"
      7 
      8 [scriptable, uuid(65944815-e9ae-48bd-a2bf-f1108720950c)]
      9 interface mozIOSPreferences : nsISupports
     10 {
     11  const long dateTimeFormatStyleNone     = 0;
     12  const long dateTimeFormatStyleShort    = 1;
     13  const long dateTimeFormatStyleMedium   = 2;
     14  const long dateTimeFormatStyleLong     = 3;
     15  const long dateTimeFormatStyleFull     = 4;
     16 
     17  /**
     18   * Returns a list of locales used by the host environment for UI
     19   * localization.
     20   *
     21   * The result is a sorted list and we expect that the OS attempts to
     22   * use the top locale from the list for which it has data.
     23   *
     24   * Each element of the list is a valid locale ID that can be passed to ICU
     25   * and ECMA402 Intl APIs,
     26   * At the same time each element is a valid BCP47 language tag that can be
     27   * used for language negotiation.
     28   *
     29   * Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
     30   */
     31  readonly attribute Array<ACString> systemLocales;
     32 
     33  /**
     34   * Returns a list of locales used by host environment for regional
     35   * preferences internationalization.
     36   *
     37   * The result is a sorted list and we expect that the OS attempts to
     38   * use the top locale from the list for which it has data.
     39   *
     40   * Each element of the list is a valid locale ID that can be passed to ICU
     41   * and ECMA402 Intl APIs,
     42   *
     43   * Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
     44   */
     45  readonly attribute Array<ACString> regionalPrefsLocales;
     46 
     47  /**
     48   * Returns the best locale that the host environment is localized to.
     49   *
     50   * The result is a valid locale ID and it should be
     51   * used for all APIs that do not handle language negotiation.
     52   *
     53   * In any scenario involving language negotiation, systemLocales should
     54   * be preferred over the single value.
     55   *
     56   * Example: "zh-Hans-HK"
     57   */
     58  readonly attribute ACString systemLocale;
     59 
     60  /**
     61   * Returns the best possible date/time pattern for the host environment
     62   * taking into account date/time regional settings user defined in the OS
     63   * preferences.
     64   *
     65   * Notice, that depending on the OS it may take into account those settings
     66   * for all locales, or only if the locale matches the OS locale.
     67   *
     68   * It takes two integer arguments that must be valid `dateTimeFormatStyle*`
     69   * values (see constants defined above), and a string representing a
     70   * BCP47 locale.
     71   *
     72   * It returns a string with a LDML date/time pattern.
     73   *
     74   * If no pattern can be retrieved from the host environment, it will
     75   * lookup the best available pattern from ICU.
     76   *
     77   * Notice, this is a pretty unique method in this API in that it does
     78   * more than look up into host environment.
     79   * The reason for that is that constructing the right date/time pattern
     80   * requires a lot of OS-specific logic and it ends up being easier to just
     81   * handle all scenarios, including with cases where we fail to retrieve
     82   * anything from the OS, here.
     83   */
     84  AUTF8String getDateTimePattern(in long timeFormatStyle,
     85                                 in long dateFormatStyle,
     86                                 [optional] in ACString locale);
     87 };