1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include
"nsISupports.idl"
7 #include
"nsILocale.idl"
10 * The Locale service interface. This is a singleton object, and should be
11 * obtained from the <tt>nsServiceManager</tt>.
13 [scriptable
, uuid(c2edc848
-4219-4440-abbf
-98119882c83f
)]
14 interface nsILocaleService
: nsISupports
17 * Create a new nsILocale from a locale string.
20 * A locale code as described in nsILocale.
21 * @return A nsILocale representing the given locale.
23 nsILocale newLocale
(in AString aLocale
);
26 * Get the user preference for locale from the operating system.
28 * @return User's OS setting for preferred locale.
30 nsILocale getSystemLocale
();
33 * Get the user preference for locale from the operating system.
35 * NOTE: This has nothing to do with the locale used for localization of
36 * the application (UI text strings etc.). This method returns something
37 * similar to getSystemLocale.
39 * @return User's OS setting for preferred locale.
41 nsILocale getApplicationLocale
();
44 * Get the most preferred locale from a list of locale preferences.
46 * @param acceptLanguage
47 * Locale preference in the same format as the Accept-Language HTTP
49 * @return The most preferred locale according to the acceptLanguage
52 nsILocale getLocaleFromAcceptLanguage
(in string acceptLanguage
);
55 * Get the user preference for locale from the operating system.
57 * NOTE: This has nothing to do with any HTTP User-Agent. This method
58 * returns the same as getSystemLocale, but as a string.
60 * @return User's OS setting for preferred locale in the format described
63 AString getLocaleComponentForUserAgent
();
68 // {C8E518C1-47AE-11d3-91CD-00105AA3F7DC}
69 #define NS_LOCALESERVICE_CID
{0xc8e518c1,0x47ae,0x11d3,{0x91,0xcd,0x0,0x10,0x5a,0xa3,0xf7,0xdc}}
70 #define NS_LOCALESERVICE_CONTRACTID
"@mozilla.org/intl/nslocaleservice;1"
73 NS_NewLocaleService
(nsILocaleService
** result
);