summaryrefslogtreecommitdiff
path: root/intl/locale/mozILocaleService.idl
blob: 297ae7c063c1f19ce0a6b26e8317279c89942342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

%{C++
// Define Contractid and CID
#define MOZ_LOCALESERVICE_CID \
  { 0x92735ff4, 0x6384, 0x4ad6, { 0x85, 0x08, 0x75, 0x70, 0x10, 0xe1, 0x49, 0xee } }

#define MOZ_LOCALESERVICE_CONTRACTID "@mozilla.org/intl/localeservice;1"
%}

[scriptable, uuid(C27F8983-B48B-4D1A-92D7-FEB8106F212D)]
interface mozILocaleService : nsISupports
{
  /**
   * Returns a list of locales that the application should be localized to.
   *
   * The result is a sorted list of valid locale IDs and it should be
   * used for all APIs that accept list of locales, like ECMA402 and L10n APIs.
   *
   * This API always returns at least one locale.
   *
   * Example: ["en-US", "de", "pl", "sr-Cyrl", "zh-Hans-HK"]
   *
   * (See LocaleService.h for a more C++-friendly version of this.)
   */
  void getAppLocales([optional] out unsigned long aCount,
                     [retval, array, size_is(aCount)] out string aLocales);

  /**
   * Returns the best locale that the application should be localized to.
   *
   * The result is a valid locale ID and it should be
   * used for all APIs that do not handle language negotiation.
   *
   * Where possible, getAppLocales() should be preferred over this API and
   * all callsites should handle some form of "best effort" language
   * negotiation to respect user preferences in case the use case does
   * not have data for the first locale in the list.
   *
   * Example: "zh-Hans-HK"
   */
  ACString getAppLocale();
};