michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsILocale.idl" michael@0: michael@0: /** michael@0: * The Locale service interface. This is a singleton object, and should be michael@0: * obtained from the nsServiceManager. michael@0: */ michael@0: [scriptable, uuid(c2edc848-4219-4440-abbf-98119882c83f)] michael@0: interface nsILocaleService : nsISupports michael@0: { michael@0: /** michael@0: * Create a new nsILocale from a locale string. michael@0: * michael@0: * @param aLocale michael@0: * A locale code as described in nsILocale. michael@0: * @return A nsILocale representing the given locale. michael@0: */ michael@0: nsILocale newLocale(in AString aLocale); michael@0: michael@0: /** michael@0: * Get the user preference for locale from the operating system. michael@0: * michael@0: * @return User's OS setting for preferred locale. michael@0: */ michael@0: nsILocale getSystemLocale(); michael@0: michael@0: /** michael@0: * Get the user preference for locale from the operating system. michael@0: * michael@0: * NOTE: This has nothing to do with the locale used for localization of michael@0: * the application (UI text strings etc.). This method returns something michael@0: * similar to getSystemLocale. michael@0: * michael@0: * @return User's OS setting for preferred locale. michael@0: */ michael@0: nsILocale getApplicationLocale(); michael@0: michael@0: /** michael@0: * Get the most preferred locale from a list of locale preferences. michael@0: * michael@0: * @param acceptLanguage michael@0: * Locale preference in the same format as the Accept-Language HTTP michael@0: * header. michael@0: * @return The most preferred locale according to the acceptLanguage michael@0: * parameter. michael@0: */ michael@0: nsILocale getLocaleFromAcceptLanguage(in string acceptLanguage); michael@0: michael@0: /** michael@0: * Get the user preference for locale from the operating system. michael@0: * michael@0: * NOTE: This has nothing to do with any HTTP User-Agent. This method michael@0: * returns the same as getSystemLocale, but as a string. michael@0: * michael@0: * @return User's OS setting for preferred locale in the format described michael@0: * in nsILocale. michael@0: */ michael@0: AString getLocaleComponentForUserAgent(); michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: // {C8E518C1-47AE-11d3-91CD-00105AA3F7DC} michael@0: #define NS_LOCALESERVICE_CID {0xc8e518c1,0x47ae,0x11d3,{0x91,0xcd,0x0,0x10,0x5a,0xa3,0xf7,0xdc}} michael@0: #define NS_LOCALESERVICE_CONTRACTID "@mozilla.org/intl/nslocaleservice;1" michael@0: michael@0: extern nsresult michael@0: NS_NewLocaleService(nsILocaleService** result); michael@0: michael@0: %} michael@0: michael@0: