1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/locale/idl/nsILocale.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 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 + 1.11 +%{C++ 1.12 +#define NSILOCALE_COLLATE "NSILOCALE_COLLATE" 1.13 +#define NSILOCALE_CTYPE "NSILOCALE_CTYPE" 1.14 +#define NSILOCALE_MONETARY "NSILOCALE_MONETARY" 1.15 +#define NSILOCALE_NUMERIC "NSILOCALE_NUMERIC" 1.16 +#define NSILOCALE_TIME "NSILOCALE_TIME" 1.17 +#define NSILOCALE_MESSAGE "NSILOCALE_MESSAGES" 1.18 + 1.19 +#define NS_LOCALE_CONTRACTID "@mozilla.org/intl/nslocale;1" 1.20 +%} 1.21 + 1.22 +/** 1.23 + * Represents one locale, which can be used for things like sorting text strings 1.24 + * and formatting numbers, dates and times. 1.25 + */ 1.26 +[scriptable, uuid(21035ee0-4556-11d3-91cd-00105aa3f7dc)] 1.27 +interface nsILocale : nsISupports 1.28 +{ 1.29 + /** 1.30 + * Get the locale code for a given category. 1.31 + * 1.32 + * A locale code is of the form language[-COUNTRY[-region]], where 1.33 + * "language" is an ISO 639 language code (two letter codes preferred over 1.34 + * three letter codes when available), "COUNTRY" is an ISO 3166 two letter 1.35 + * country code, and "region" is a string of up to 5 letters. 1.36 + * 1.37 + * A category is one of the following: 1.38 + * NSILOCALE_CTYPE: Character classification and case conversion. 1.39 + * NSILOCALE_COLLATE: Collation order. How strings are sorted. 1.40 + * NSILOCALE_MONETARY: Monetary formatting. 1.41 + * NSILOCALE_NUMERIC: Numeric, non-monetary formatting. 1.42 + * NSILOCALE_TIME: Date and time formats. 1.43 + * NSILOCALE_MESSAGES: Related to fonts, character encodings etc. 1.44 + * 1.45 + * @param category 1.46 + * The category of interest. 1.47 + * @return The locale code to be used for the given category. 1.48 + */ 1.49 + AString getCategory(in AString category); 1.50 +};