|
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/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 #include "nsILocale.idl" |
|
8 |
|
9 /** |
|
10 * The Locale service interface. This is a singleton object, and should be |
|
11 * obtained from the <tt>nsServiceManager</tt>. |
|
12 */ |
|
13 [scriptable, uuid(c2edc848-4219-4440-abbf-98119882c83f)] |
|
14 interface nsILocaleService : nsISupports |
|
15 { |
|
16 /** |
|
17 * Create a new nsILocale from a locale string. |
|
18 * |
|
19 * @param aLocale |
|
20 * A locale code as described in nsILocale. |
|
21 * @return A nsILocale representing the given locale. |
|
22 */ |
|
23 nsILocale newLocale(in AString aLocale); |
|
24 |
|
25 /** |
|
26 * Get the user preference for locale from the operating system. |
|
27 * |
|
28 * @return User's OS setting for preferred locale. |
|
29 */ |
|
30 nsILocale getSystemLocale(); |
|
31 |
|
32 /** |
|
33 * Get the user preference for locale from the operating system. |
|
34 * |
|
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. |
|
38 * |
|
39 * @return User's OS setting for preferred locale. |
|
40 */ |
|
41 nsILocale getApplicationLocale(); |
|
42 |
|
43 /** |
|
44 * Get the most preferred locale from a list of locale preferences. |
|
45 * |
|
46 * @param acceptLanguage |
|
47 * Locale preference in the same format as the Accept-Language HTTP |
|
48 * header. |
|
49 * @return The most preferred locale according to the acceptLanguage |
|
50 * parameter. |
|
51 */ |
|
52 nsILocale getLocaleFromAcceptLanguage(in string acceptLanguage); |
|
53 |
|
54 /** |
|
55 * Get the user preference for locale from the operating system. |
|
56 * |
|
57 * NOTE: This has nothing to do with any HTTP User-Agent. This method |
|
58 * returns the same as getSystemLocale, but as a string. |
|
59 * |
|
60 * @return User's OS setting for preferred locale in the format described |
|
61 * in nsILocale. |
|
62 */ |
|
63 AString getLocaleComponentForUserAgent(); |
|
64 }; |
|
65 |
|
66 %{C++ |
|
67 |
|
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" |
|
71 |
|
72 extern nsresult |
|
73 NS_NewLocaleService(nsILocaleService** result); |
|
74 |
|
75 %} |
|
76 |
|
77 |