intl/locale/idl/nsILocaleService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/locale/idl/nsILocaleService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +#include "nsILocale.idl"
    1.11 +
    1.12 +/**
    1.13 + * The Locale service interface. This is a singleton object, and should be
    1.14 + * obtained from the <tt>nsServiceManager</tt>.
    1.15 + */
    1.16 +[scriptable, uuid(c2edc848-4219-4440-abbf-98119882c83f)]
    1.17 +interface nsILocaleService : nsISupports
    1.18 +{
    1.19 +    /**
    1.20 +     * Create a new nsILocale from a locale string.
    1.21 +     *
    1.22 +     * @param aLocale
    1.23 +     *        A locale code as described in nsILocale.
    1.24 +     * @return A nsILocale representing the given locale.
    1.25 +     */
    1.26 +    nsILocale newLocale(in AString aLocale);
    1.27 +
    1.28 +    /**
    1.29 +     * Get the user preference for locale from the operating system.
    1.30 +     *
    1.31 +     * @return User's OS setting for preferred locale.
    1.32 +     */
    1.33 +    nsILocale getSystemLocale();
    1.34 +
    1.35 +    /**
    1.36 +     * Get the user preference for locale from the operating system.
    1.37 +     * 
    1.38 +     * NOTE: This has nothing to do with the locale used for localization of
    1.39 +     * the application (UI text strings etc.). This method returns something
    1.40 +     * similar to getSystemLocale.
    1.41 +     *
    1.42 +     * @return User's OS setting for preferred locale.
    1.43 +     */
    1.44 +    nsILocale getApplicationLocale();
    1.45 +
    1.46 +    /**
    1.47 +     * Get the most preferred locale from a list of locale preferences.
    1.48 +     *
    1.49 +     * @param acceptLanguage
    1.50 +     *        Locale preference in the same format as the Accept-Language HTTP
    1.51 +     *        header.
    1.52 +     * @return The most preferred locale according to the acceptLanguage
    1.53 +     *         parameter.
    1.54 +     */
    1.55 +    nsILocale getLocaleFromAcceptLanguage(in string acceptLanguage);
    1.56 +
    1.57 +    /**
    1.58 +     * Get the user preference for locale from the operating system.
    1.59 +     *
    1.60 +     * NOTE: This has nothing to do with any HTTP User-Agent. This method
    1.61 +     * returns the same as getSystemLocale, but as a string.
    1.62 +     *
    1.63 +     * @return User's OS setting for preferred locale in the format described
    1.64 +     *         in nsILocale.
    1.65 +     */
    1.66 +    AString getLocaleComponentForUserAgent();
    1.67 +};
    1.68 +
    1.69 +%{C++
    1.70 +
    1.71 +// {C8E518C1-47AE-11d3-91CD-00105AA3F7DC}
    1.72 +#define NS_LOCALESERVICE_CID {0xc8e518c1,0x47ae,0x11d3,{0x91,0xcd,0x0,0x10,0x5a,0xa3,0xf7,0xdc}}
    1.73 +#define NS_LOCALESERVICE_CONTRACTID "@mozilla.org/intl/nslocaleservice;1"
    1.74 +
    1.75 +extern nsresult
    1.76 +NS_NewLocaleService(nsILocaleService** result);
    1.77 +
    1.78 +%}
    1.79 +
    1.80 +

mercurial