sl@0
|
1 |
/*
|
sl@0
|
2 |
**********************************************************************
|
sl@0
|
3 |
* Copyright (C) 1997-2005, International Business Machines
|
sl@0
|
4 |
* Corporation and others. All Rights Reserved.
|
sl@0
|
5 |
**********************************************************************
|
sl@0
|
6 |
*
|
sl@0
|
7 |
* File ULOC.H
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Modification History:
|
sl@0
|
10 |
*
|
sl@0
|
11 |
* Date Name Description
|
sl@0
|
12 |
* 04/01/97 aliu Creation.
|
sl@0
|
13 |
* 08/22/98 stephen JDK 1.2 sync.
|
sl@0
|
14 |
* 12/08/98 rtg New C API for Locale
|
sl@0
|
15 |
* 03/30/99 damiba overhaul
|
sl@0
|
16 |
* 03/31/99 helena Javadoc for uloc functions.
|
sl@0
|
17 |
* 04/15/99 Madhu Updated Javadoc
|
sl@0
|
18 |
********************************************************************************
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifndef ULOC_H
|
sl@0
|
22 |
#define ULOC_H
|
sl@0
|
23 |
|
sl@0
|
24 |
#include "unicode/utypes.h"
|
sl@0
|
25 |
#include "unicode/uenum.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
* \file
|
sl@0
|
29 |
* \brief C API: Locale
|
sl@0
|
30 |
*
|
sl@0
|
31 |
* <h2> ULoc C API for Locale </h2>
|
sl@0
|
32 |
* A <code>Locale</code> represents a specific geographical, political,
|
sl@0
|
33 |
* or cultural region. An operation that requires a <code>Locale</code> to perform
|
sl@0
|
34 |
* its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
|
sl@0
|
35 |
* to tailor information for the user. For example, displaying a number
|
sl@0
|
36 |
* is a locale-sensitive operation--the number should be formatted
|
sl@0
|
37 |
* according to the customs/conventions of the user's native country,
|
sl@0
|
38 |
* region, or culture. In the C APIs, a locales is simply a const char string.
|
sl@0
|
39 |
*
|
sl@0
|
40 |
* <P>
|
sl@0
|
41 |
* You create a <code>Locale</code> with one of the three options listed below.
|
sl@0
|
42 |
* Each of the component is separated by '_' in the locale string.
|
sl@0
|
43 |
* \htmlonly<blockquote>\endhtmlonly
|
sl@0
|
44 |
* <pre>
|
sl@0
|
45 |
* \code
|
sl@0
|
46 |
* newLanguage
|
sl@0
|
47 |
*
|
sl@0
|
48 |
* newLanguage + newCountry
|
sl@0
|
49 |
*
|
sl@0
|
50 |
* newLanguage + newCountry + newVariant
|
sl@0
|
51 |
* \endcode
|
sl@0
|
52 |
* </pre>
|
sl@0
|
53 |
* \htmlonly</blockquote>\endhtmlonly
|
sl@0
|
54 |
* The first option is a valid <STRONG>ISO
|
sl@0
|
55 |
* Language Code.</STRONG> These codes are the lower-case two-letter
|
sl@0
|
56 |
* codes as defined by ISO-639.
|
sl@0
|
57 |
* You can find a full list of these codes at a number of sites, such as:
|
sl@0
|
58 |
* <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
|
sl@0
|
59 |
* http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
|
sl@0
|
60 |
*
|
sl@0
|
61 |
* <P>
|
sl@0
|
62 |
* The second option includes an additonal <STRONG>ISO Country
|
sl@0
|
63 |
* Code.</STRONG> These codes are the upper-case two-letter codes
|
sl@0
|
64 |
* as defined by ISO-3166.
|
sl@0
|
65 |
* You can find a full list of these codes at a number of sites, such as:
|
sl@0
|
66 |
* <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
|
sl@0
|
67 |
* http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
|
sl@0
|
68 |
*
|
sl@0
|
69 |
* <P>
|
sl@0
|
70 |
* The third option requires another additonal information--the
|
sl@0
|
71 |
* <STRONG>Variant.</STRONG>
|
sl@0
|
72 |
* The Variant codes are vendor and browser-specific.
|
sl@0
|
73 |
* For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
|
sl@0
|
74 |
* Where there are two variants, separate them with an underscore, and
|
sl@0
|
75 |
* put the most important one first. For
|
sl@0
|
76 |
* example, a Traditional Spanish collation might be referenced, with
|
sl@0
|
77 |
* "ES", "ES", "Traditional_WIN".
|
sl@0
|
78 |
*
|
sl@0
|
79 |
* <P>
|
sl@0
|
80 |
* Because a <code>Locale</code> is just an identifier for a region,
|
sl@0
|
81 |
* no validity check is performed when you specify a <code>Locale</code>.
|
sl@0
|
82 |
* If you want to see whether particular resources are available for the
|
sl@0
|
83 |
* <code>Locale</code> you asked for, you must query those resources. For
|
sl@0
|
84 |
* example, ask the <code>UNumberFormat</code> for the locales it supports
|
sl@0
|
85 |
* using its <code>getAvailable</code> method.
|
sl@0
|
86 |
* <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
|
sl@0
|
87 |
* locale, you get back the best available match, not necessarily
|
sl@0
|
88 |
* precisely what you asked for. For more information, look at
|
sl@0
|
89 |
* <code>UResourceBundle</code>.
|
sl@0
|
90 |
*
|
sl@0
|
91 |
* <P>
|
sl@0
|
92 |
* The <code>Locale</code> provides a number of convenient constants
|
sl@0
|
93 |
* that you can use to specify the commonly used
|
sl@0
|
94 |
* locales. For example, the following refers to a locale
|
sl@0
|
95 |
* for the United States:
|
sl@0
|
96 |
* \htmlonly<blockquote>\endhtmlonly
|
sl@0
|
97 |
* <pre>
|
sl@0
|
98 |
* \code
|
sl@0
|
99 |
* ULOC_US
|
sl@0
|
100 |
* \endcode
|
sl@0
|
101 |
* </pre>
|
sl@0
|
102 |
* \htmlonly</blockquote>\endhtmlonly
|
sl@0
|
103 |
*
|
sl@0
|
104 |
* <P>
|
sl@0
|
105 |
* Once you've specified a locale you can query it for information about
|
sl@0
|
106 |
* itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
|
sl@0
|
107 |
* <code>uloc_getLanguage</code> to get the ISO Language Code. You can
|
sl@0
|
108 |
* use <code>uloc_getDisplayCountry</code> to get the
|
sl@0
|
109 |
* name of the country suitable for displaying to the user. Similarly,
|
sl@0
|
110 |
* you can use <code>uloc_getDisplayLanguage</code> to get the name of
|
sl@0
|
111 |
* the language suitable for displaying to the user. Interestingly,
|
sl@0
|
112 |
* the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
|
sl@0
|
113 |
* and have two versions: one that uses the default locale and one
|
sl@0
|
114 |
* that takes a locale as an argument and displays the name or country in
|
sl@0
|
115 |
* a language appropriate to that locale.
|
sl@0
|
116 |
*
|
sl@0
|
117 |
* <P>
|
sl@0
|
118 |
* The ICU provides a number of services that perform locale-sensitive
|
sl@0
|
119 |
* operations. For example, the <code>unum_xxx</code> functions format
|
sl@0
|
120 |
* numbers, currency, or percentages in a locale-sensitive manner.
|
sl@0
|
121 |
* </P>
|
sl@0
|
122 |
* \htmlonly<blockquote>\endhtmlonly
|
sl@0
|
123 |
* <pre>
|
sl@0
|
124 |
* \code
|
sl@0
|
125 |
* UErrorCode success = U_ZERO_ERROR;
|
sl@0
|
126 |
* UNumberFormat *nf;
|
sl@0
|
127 |
* const char* myLocale = "fr_FR";
|
sl@0
|
128 |
*
|
sl@0
|
129 |
* nf = unum_open( UNUM_DEFAULT, NULL, success );
|
sl@0
|
130 |
* unum_close(nf);
|
sl@0
|
131 |
* nf = unum_open( UNUM_CURRENCY, NULL, success );
|
sl@0
|
132 |
* unum_close(nf);
|
sl@0
|
133 |
* nf = unum_open( UNUM_PERCENT, NULL, success );
|
sl@0
|
134 |
* unum_close(nf);
|
sl@0
|
135 |
* \endcode
|
sl@0
|
136 |
* </pre>
|
sl@0
|
137 |
* \htmlonly</blockquote>\endhtmlonly
|
sl@0
|
138 |
* Each of these methods has two variants; one with an explicit locale
|
sl@0
|
139 |
* and one without; the latter using the default locale.
|
sl@0
|
140 |
* \htmlonly<blockquote>\endhtmlonly
|
sl@0
|
141 |
* <pre>
|
sl@0
|
142 |
* \code
|
sl@0
|
143 |
*
|
sl@0
|
144 |
* nf = unum_open( UNUM_DEFAULT, myLocale, success );
|
sl@0
|
145 |
* unum_close(nf);
|
sl@0
|
146 |
* nf = unum_open( UNUM_CURRENCY, myLocale, success );
|
sl@0
|
147 |
* unum_close(nf);
|
sl@0
|
148 |
* nf = unum_open( UNUM_PERCENT, myLocale, success );
|
sl@0
|
149 |
* unum_close(nf);
|
sl@0
|
150 |
* \endcode
|
sl@0
|
151 |
* </pre>
|
sl@0
|
152 |
* \htmlonly</blockquote>\endhtmlonly
|
sl@0
|
153 |
* A <code>Locale</code> is the mechanism for identifying the kind of services
|
sl@0
|
154 |
* (<code>UNumberFormat</code>) that you would like to get. The locale is
|
sl@0
|
155 |
* <STRONG>just</STRONG> a mechanism for identifying these services.
|
sl@0
|
156 |
*
|
sl@0
|
157 |
* <P>
|
sl@0
|
158 |
* Each international serivce that performs locale-sensitive operations
|
sl@0
|
159 |
* allows you
|
sl@0
|
160 |
* to get all the available objects of that type. You can sift
|
sl@0
|
161 |
* through these objects by language, country, or variant,
|
sl@0
|
162 |
* and use the display names to present a menu to the user.
|
sl@0
|
163 |
* For example, you can create a menu of all the collation objects
|
sl@0
|
164 |
* suitable for a given language. Such classes implement these
|
sl@0
|
165 |
* three class methods:
|
sl@0
|
166 |
* \htmlonly<blockquote>\endhtmlonly
|
sl@0
|
167 |
* <pre>
|
sl@0
|
168 |
* \code
|
sl@0
|
169 |
* const char* uloc_getAvailable(int32_t index);
|
sl@0
|
170 |
* int32_t uloc_countAvailable();
|
sl@0
|
171 |
* int32_t
|
sl@0
|
172 |
* uloc_getDisplayName(const char* localeID,
|
sl@0
|
173 |
* const char* inLocaleID,
|
sl@0
|
174 |
* UChar* result,
|
sl@0
|
175 |
* int32_t maxResultSize,
|
sl@0
|
176 |
* UErrorCode* err);
|
sl@0
|
177 |
*
|
sl@0
|
178 |
* \endcode
|
sl@0
|
179 |
* </pre>
|
sl@0
|
180 |
* \htmlonly</blockquote>\endhtmlonly
|
sl@0
|
181 |
* <P>
|
sl@0
|
182 |
* Concerning POSIX/RFC1766 Locale IDs,
|
sl@0
|
183 |
* the getLanguage/getCountry/getVariant/getName functions do understand
|
sl@0
|
184 |
* the POSIX type form of language_COUNTRY.ENCODING\@VARIANT
|
sl@0
|
185 |
* and if there is not an ICU-stype variant, uloc_getVariant() for example
|
sl@0
|
186 |
* will return the one listed after the \@at sign. As well, the hyphen
|
sl@0
|
187 |
* "-" is recognized as a country/variant separator similarly to RFC1766.
|
sl@0
|
188 |
* So for example, "en-us" will be interpreted as en_US.
|
sl@0
|
189 |
* As a result, uloc_getName() is far from a no-op, and will have the
|
sl@0
|
190 |
* effect of converting POSIX/RFC1766 IDs into ICU form, although it does
|
sl@0
|
191 |
* NOT map any of the actual codes (i.e. russian->ru) in any way.
|
sl@0
|
192 |
* Applications should call uloc_getName() at the point where a locale ID
|
sl@0
|
193 |
* is coming from an external source (user entry, OS, web browser)
|
sl@0
|
194 |
* and pass the resulting string to other ICU functions. For example,
|
sl@0
|
195 |
* don't use de-de\@EURO as an argument to resourcebundle.
|
sl@0
|
196 |
*
|
sl@0
|
197 |
* @see UResourceBundle
|
sl@0
|
198 |
*/
|
sl@0
|
199 |
|
sl@0
|
200 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
201 |
#define ULOC_CHINESE "zh"
|
sl@0
|
202 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
203 |
#define ULOC_ENGLISH "en"
|
sl@0
|
204 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
205 |
#define ULOC_FRENCH "fr"
|
sl@0
|
206 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
207 |
#define ULOC_GERMAN "de"
|
sl@0
|
208 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
209 |
#define ULOC_ITALIAN "it"
|
sl@0
|
210 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
211 |
#define ULOC_JAPANESE "ja"
|
sl@0
|
212 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
213 |
#define ULOC_KOREAN "ko"
|
sl@0
|
214 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
215 |
#define ULOC_SIMPLIFIED_CHINESE "zh_CN"
|
sl@0
|
216 |
/** Useful constant for this language. @stable ICU 2.0 */
|
sl@0
|
217 |
#define ULOC_TRADITIONAL_CHINESE "zh_TW"
|
sl@0
|
218 |
|
sl@0
|
219 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
220 |
#define ULOC_CANADA "en_CA"
|
sl@0
|
221 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
222 |
#define ULOC_CANADA_FRENCH "fr_CA"
|
sl@0
|
223 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
224 |
#define ULOC_CHINA "zh_CN"
|
sl@0
|
225 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
226 |
#define ULOC_PRC "zh_CN"
|
sl@0
|
227 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
228 |
#define ULOC_FRANCE "fr_FR"
|
sl@0
|
229 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
230 |
#define ULOC_GERMANY "de_DE"
|
sl@0
|
231 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
232 |
#define ULOC_ITALY "it_IT"
|
sl@0
|
233 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
234 |
#define ULOC_JAPAN "ja_JP"
|
sl@0
|
235 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
236 |
#define ULOC_KOREA "ko_KR"
|
sl@0
|
237 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
238 |
#define ULOC_TAIWAN "zh_TW"
|
sl@0
|
239 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
240 |
#define ULOC_UK "en_GB"
|
sl@0
|
241 |
/** Useful constant for this country/region. @stable ICU 2.0 */
|
sl@0
|
242 |
#define ULOC_US "en_US"
|
sl@0
|
243 |
|
sl@0
|
244 |
/**
|
sl@0
|
245 |
* Useful constant for the maximum size of the language part of a locale ID.
|
sl@0
|
246 |
* (including the terminating NULL).
|
sl@0
|
247 |
* @stable ICU 2.0
|
sl@0
|
248 |
*/
|
sl@0
|
249 |
#define ULOC_LANG_CAPACITY 12
|
sl@0
|
250 |
|
sl@0
|
251 |
/**
|
sl@0
|
252 |
* Useful constant for the maximum size of the country part of a locale ID
|
sl@0
|
253 |
* (including the terminating NULL).
|
sl@0
|
254 |
* @stable ICU 2.0
|
sl@0
|
255 |
*/
|
sl@0
|
256 |
#define ULOC_COUNTRY_CAPACITY 4
|
sl@0
|
257 |
/**
|
sl@0
|
258 |
* Useful constant for the maximum size of the whole locale ID
|
sl@0
|
259 |
* (including the terminating NULL).
|
sl@0
|
260 |
* @stable ICU 2.0
|
sl@0
|
261 |
*/
|
sl@0
|
262 |
#define ULOC_FULLNAME_CAPACITY 56
|
sl@0
|
263 |
|
sl@0
|
264 |
|
sl@0
|
265 |
#ifndef U_HIDE_DRAFT_API
|
sl@0
|
266 |
|
sl@0
|
267 |
/**
|
sl@0
|
268 |
* Useful constant for the maximum size of the script part of a locale ID
|
sl@0
|
269 |
* (including the terminating NULL).
|
sl@0
|
270 |
* @internal ICU 2.8
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
#define ULOC_SCRIPT_CAPACITY 6
|
sl@0
|
273 |
|
sl@0
|
274 |
/**
|
sl@0
|
275 |
* Useful constant for the maximum size of keywords in a locale
|
sl@0
|
276 |
* @internal ICU 2.8
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
#define ULOC_KEYWORDS_CAPACITY 50
|
sl@0
|
279 |
|
sl@0
|
280 |
/**
|
sl@0
|
281 |
* Useful constant for the maximum size of keywords in a locale
|
sl@0
|
282 |
* @internal ICU 2.8
|
sl@0
|
283 |
*/
|
sl@0
|
284 |
#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
|
sl@0
|
285 |
|
sl@0
|
286 |
/**
|
sl@0
|
287 |
* Character separating keywords from the locale string
|
sl@0
|
288 |
* different for EBCDIC - TODO
|
sl@0
|
289 |
* @stable ICU 2.8
|
sl@0
|
290 |
*/
|
sl@0
|
291 |
#define ULOC_KEYWORD_SEPARATOR '@'
|
sl@0
|
292 |
/**
|
sl@0
|
293 |
* Character for assigning value to a keyword
|
sl@0
|
294 |
* @stable ICU 2.8
|
sl@0
|
295 |
*/
|
sl@0
|
296 |
#define ULOC_KEYWORD_ASSIGN '='
|
sl@0
|
297 |
/**
|
sl@0
|
298 |
* Character separating keywords
|
sl@0
|
299 |
* @stable ICU 2.8
|
sl@0
|
300 |
*/
|
sl@0
|
301 |
#define ULOC_KEYWORD_ITEM_SEPARATOR ';'
|
sl@0
|
302 |
|
sl@0
|
303 |
#endif /*U_HIDE_DRAFT_API*/
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
* Constants for *_getLocale()
|
sl@0
|
307 |
* Allow user to select whether she wants information on
|
sl@0
|
308 |
* requested, valid or actual locale.
|
sl@0
|
309 |
* For example, a collator for "en_US_CALIFORNIA" was
|
sl@0
|
310 |
* requested. In the current state of ICU (2.0),
|
sl@0
|
311 |
* the requested locale is "en_US_CALIFORNIA",
|
sl@0
|
312 |
* the valid locale is "en_US" (most specific locale supported by ICU)
|
sl@0
|
313 |
* and the actual locale is "root" (the collation data comes unmodified
|
sl@0
|
314 |
* from the UCA)
|
sl@0
|
315 |
* The locale is considered supported by ICU if there is a core ICU bundle
|
sl@0
|
316 |
* for that locale (although it may be empty).
|
sl@0
|
317 |
* @stable ICU 2.1
|
sl@0
|
318 |
*/
|
sl@0
|
319 |
typedef enum {
|
sl@0
|
320 |
/** This is locale the data actually comes from
|
sl@0
|
321 |
* @stable ICU 2.1
|
sl@0
|
322 |
*/
|
sl@0
|
323 |
ULOC_ACTUAL_LOCALE = 0,
|
sl@0
|
324 |
/** This is the most specific locale supported by ICU
|
sl@0
|
325 |
* @stable ICU 2.1
|
sl@0
|
326 |
*/
|
sl@0
|
327 |
ULOC_VALID_LOCALE = 1,
|
sl@0
|
328 |
|
sl@0
|
329 |
#ifndef U_HIDE_DEPRECATED_API
|
sl@0
|
330 |
/** This is the requested locale
|
sl@0
|
331 |
* @deprecated ICU 2.8
|
sl@0
|
332 |
*/
|
sl@0
|
333 |
ULOC_REQUESTED_LOCALE = 2,
|
sl@0
|
334 |
#endif /* U_HIDE_DEPRECATED_API */
|
sl@0
|
335 |
|
sl@0
|
336 |
ULOC_DATA_LOCALE_TYPE_LIMIT
|
sl@0
|
337 |
} ULocDataLocaleType ;
|
sl@0
|
338 |
|
sl@0
|
339 |
|
sl@0
|
340 |
/**
|
sl@0
|
341 |
* Gets ICU's default locale.
|
sl@0
|
342 |
* The returned string is a snapshot in time, and will remain valid
|
sl@0
|
343 |
* and unchanged even when uloc_setDefault() is called.
|
sl@0
|
344 |
* The returned storage is owned by ICU, and must not be altered or deleted
|
sl@0
|
345 |
* by the caller.
|
sl@0
|
346 |
*
|
sl@0
|
347 |
* @return the ICU default locale
|
sl@0
|
348 |
* @system
|
sl@0
|
349 |
* @stable ICU 2.0
|
sl@0
|
350 |
*/
|
sl@0
|
351 |
U_STABLE const char* U_EXPORT2
|
sl@0
|
352 |
uloc_getDefault(void);
|
sl@0
|
353 |
|
sl@0
|
354 |
/**
|
sl@0
|
355 |
* Sets ICU's default locale.
|
sl@0
|
356 |
* By default (without calling this function), ICU's default locale will be based
|
sl@0
|
357 |
* on information obtained from the underlying system environment.
|
sl@0
|
358 |
* <p>
|
sl@0
|
359 |
* Changes to ICU's default locale do not propagate back to the
|
sl@0
|
360 |
* system environment.
|
sl@0
|
361 |
* <p>
|
sl@0
|
362 |
* Changes to ICU's default locale to not affect any ICU services that
|
sl@0
|
363 |
* may already be open based on the previous default locale value.
|
sl@0
|
364 |
*
|
sl@0
|
365 |
* @param localeID the new ICU default locale. A value of NULL will try to get
|
sl@0
|
366 |
* the system's default locale.
|
sl@0
|
367 |
* @param status the error information if the setting of default locale fails
|
sl@0
|
368 |
* @system
|
sl@0
|
369 |
* @stable ICU 2.0
|
sl@0
|
370 |
*/
|
sl@0
|
371 |
U_STABLE void U_EXPORT2
|
sl@0
|
372 |
uloc_setDefault(const char* localeID,
|
sl@0
|
373 |
UErrorCode* status);
|
sl@0
|
374 |
|
sl@0
|
375 |
/**
|
sl@0
|
376 |
* Gets the language code for the specified locale.
|
sl@0
|
377 |
*
|
sl@0
|
378 |
* @param localeID the locale to get the ISO language code with
|
sl@0
|
379 |
* @param language the language code for localeID
|
sl@0
|
380 |
* @param languageCapacity the size of the language buffer to store the
|
sl@0
|
381 |
* language code with
|
sl@0
|
382 |
* @param err error information if retrieving the language code failed
|
sl@0
|
383 |
* @return the actual buffer size needed for the language code. If it's greater
|
sl@0
|
384 |
* than languageCapacity, the returned language code will be truncated.
|
sl@0
|
385 |
* @stable ICU 2.0
|
sl@0
|
386 |
*/
|
sl@0
|
387 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
388 |
uloc_getLanguage(const char* localeID,
|
sl@0
|
389 |
char* language,
|
sl@0
|
390 |
int32_t languageCapacity,
|
sl@0
|
391 |
UErrorCode* err);
|
sl@0
|
392 |
|
sl@0
|
393 |
/**
|
sl@0
|
394 |
* Gets the script code for the specified locale.
|
sl@0
|
395 |
*
|
sl@0
|
396 |
* @param localeID the locale to get the ISO language code with
|
sl@0
|
397 |
* @param script the language code for localeID
|
sl@0
|
398 |
* @param scriptCapacity the size of the language buffer to store the
|
sl@0
|
399 |
* language code with
|
sl@0
|
400 |
* @param err error information if retrieving the language code failed
|
sl@0
|
401 |
* @return the actual buffer size needed for the language code. If it's greater
|
sl@0
|
402 |
* than scriptCapacity, the returned language code will be truncated.
|
sl@0
|
403 |
* @stable ICU 2.8
|
sl@0
|
404 |
*/
|
sl@0
|
405 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
406 |
uloc_getScript(const char* localeID,
|
sl@0
|
407 |
char* script,
|
sl@0
|
408 |
int32_t scriptCapacity,
|
sl@0
|
409 |
UErrorCode* err);
|
sl@0
|
410 |
|
sl@0
|
411 |
/**
|
sl@0
|
412 |
* Gets the country code for the specified locale.
|
sl@0
|
413 |
*
|
sl@0
|
414 |
* @param localeID the locale to get the country code with
|
sl@0
|
415 |
* @param country the country code for localeID
|
sl@0
|
416 |
* @param countryCapacity the size of the country buffer to store the
|
sl@0
|
417 |
* country code with
|
sl@0
|
418 |
* @param err error information if retrieving the country code failed
|
sl@0
|
419 |
* @return the actual buffer size needed for the country code. If it's greater
|
sl@0
|
420 |
* than countryCapacity, the returned country code will be truncated.
|
sl@0
|
421 |
* @stable ICU 2.0
|
sl@0
|
422 |
*/
|
sl@0
|
423 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
424 |
uloc_getCountry(const char* localeID,
|
sl@0
|
425 |
char* country,
|
sl@0
|
426 |
int32_t countryCapacity,
|
sl@0
|
427 |
UErrorCode* err);
|
sl@0
|
428 |
|
sl@0
|
429 |
/**
|
sl@0
|
430 |
* Gets the variant code for the specified locale.
|
sl@0
|
431 |
*
|
sl@0
|
432 |
* @param localeID the locale to get the variant code with
|
sl@0
|
433 |
* @param variant the variant code for localeID
|
sl@0
|
434 |
* @param variantCapacity the size of the variant buffer to store the
|
sl@0
|
435 |
* variant code with
|
sl@0
|
436 |
* @param err error information if retrieving the variant code failed
|
sl@0
|
437 |
* @return the actual buffer size needed for the variant code. If it's greater
|
sl@0
|
438 |
* than variantCapacity, the returned variant code will be truncated.
|
sl@0
|
439 |
* @stable ICU 2.0
|
sl@0
|
440 |
*/
|
sl@0
|
441 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
442 |
uloc_getVariant(const char* localeID,
|
sl@0
|
443 |
char* variant,
|
sl@0
|
444 |
int32_t variantCapacity,
|
sl@0
|
445 |
UErrorCode* err);
|
sl@0
|
446 |
|
sl@0
|
447 |
|
sl@0
|
448 |
/**
|
sl@0
|
449 |
* Gets the full name for the specified locale.
|
sl@0
|
450 |
* Note: This has the effect of 'canonicalizing' the ICU locale ID to
|
sl@0
|
451 |
* a certain extent. Upper and lower case are set as needed.
|
sl@0
|
452 |
* It does NOT map aliased names in any way.
|
sl@0
|
453 |
* See the top of this header file.
|
sl@0
|
454 |
* This API supports preflighting.
|
sl@0
|
455 |
*
|
sl@0
|
456 |
* @param localeID the locale to get the full name with
|
sl@0
|
457 |
* @param name fill in buffer for the name without keywords.
|
sl@0
|
458 |
* @param nameCapacity capacity of the fill in buffer.
|
sl@0
|
459 |
* @param err error information if retrieving the full name failed
|
sl@0
|
460 |
* @return the actual buffer size needed for the full name. If it's greater
|
sl@0
|
461 |
* than nameCapacity, the returned full name will be truncated.
|
sl@0
|
462 |
* @stable ICU 2.0
|
sl@0
|
463 |
*/
|
sl@0
|
464 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
465 |
uloc_getName(const char* localeID,
|
sl@0
|
466 |
char* name,
|
sl@0
|
467 |
int32_t nameCapacity,
|
sl@0
|
468 |
UErrorCode* err);
|
sl@0
|
469 |
|
sl@0
|
470 |
/**
|
sl@0
|
471 |
* Gets the full name for the specified locale.
|
sl@0
|
472 |
* Note: This has the effect of 'canonicalizing' the string to
|
sl@0
|
473 |
* a certain extent. Upper and lower case are set as needed,
|
sl@0
|
474 |
* and if the components were in 'POSIX' format they are changed to
|
sl@0
|
475 |
* ICU format. It does NOT map aliased names in any way.
|
sl@0
|
476 |
* See the top of this header file.
|
sl@0
|
477 |
*
|
sl@0
|
478 |
* @param localeID the locale to get the full name with
|
sl@0
|
479 |
* @param name the full name for localeID
|
sl@0
|
480 |
* @param nameCapacity the size of the name buffer to store the
|
sl@0
|
481 |
* full name with
|
sl@0
|
482 |
* @param err error information if retrieving the full name failed
|
sl@0
|
483 |
* @return the actual buffer size needed for the full name. If it's greater
|
sl@0
|
484 |
* than nameCapacity, the returned full name will be truncated.
|
sl@0
|
485 |
* @stable ICU 2.8
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
488 |
uloc_canonicalize(const char* localeID,
|
sl@0
|
489 |
char* name,
|
sl@0
|
490 |
int32_t nameCapacity,
|
sl@0
|
491 |
UErrorCode* err);
|
sl@0
|
492 |
|
sl@0
|
493 |
/**
|
sl@0
|
494 |
* Gets the ISO language code for the specified locale.
|
sl@0
|
495 |
*
|
sl@0
|
496 |
* @param localeID the locale to get the ISO language code with
|
sl@0
|
497 |
* @return language the ISO language code for localeID
|
sl@0
|
498 |
* @stable ICU 2.0
|
sl@0
|
499 |
*/
|
sl@0
|
500 |
U_STABLE const char* U_EXPORT2
|
sl@0
|
501 |
uloc_getISO3Language(const char* localeID);
|
sl@0
|
502 |
|
sl@0
|
503 |
|
sl@0
|
504 |
/**
|
sl@0
|
505 |
* Gets the ISO country code for the specified locale.
|
sl@0
|
506 |
*
|
sl@0
|
507 |
* @param localeID the locale to get the ISO country code with
|
sl@0
|
508 |
* @return country the ISO country code for localeID
|
sl@0
|
509 |
* @stable ICU 2.0
|
sl@0
|
510 |
*/
|
sl@0
|
511 |
U_STABLE const char* U_EXPORT2
|
sl@0
|
512 |
uloc_getISO3Country(const char* localeID);
|
sl@0
|
513 |
|
sl@0
|
514 |
/**
|
sl@0
|
515 |
* Gets the Win32 LCID value for the specified locale.
|
sl@0
|
516 |
* If the ICU locale is not recognized by Windows, 0 will be returned.
|
sl@0
|
517 |
*
|
sl@0
|
518 |
* @param localeID the locale to get the Win32 LCID value with
|
sl@0
|
519 |
* @return country the Win32 LCID for localeID
|
sl@0
|
520 |
* @stable ICU 2.0
|
sl@0
|
521 |
*/
|
sl@0
|
522 |
U_STABLE uint32_t U_EXPORT2
|
sl@0
|
523 |
uloc_getLCID(const char* localeID);
|
sl@0
|
524 |
|
sl@0
|
525 |
/**
|
sl@0
|
526 |
* Gets the language name suitable for display for the specified locale.
|
sl@0
|
527 |
*
|
sl@0
|
528 |
* @param locale the locale to get the ISO language code with
|
sl@0
|
529 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
530 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
531 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
532 |
* for inLocale would result in "Englisch".
|
sl@0
|
533 |
* @param language the displayable language code for localeID
|
sl@0
|
534 |
* @param languageCapacity the size of the language buffer to store the
|
sl@0
|
535 |
* displayable language code with
|
sl@0
|
536 |
* @param status error information if retrieving the displayable language code failed
|
sl@0
|
537 |
* @return the actual buffer size needed for the displayable language code. If it's greater
|
sl@0
|
538 |
* than languageCapacity, the returned language code will be truncated.
|
sl@0
|
539 |
* @stable ICU 2.0
|
sl@0
|
540 |
*/
|
sl@0
|
541 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
542 |
uloc_getDisplayLanguage(const char* locale,
|
sl@0
|
543 |
const char* displayLocale,
|
sl@0
|
544 |
UChar* language,
|
sl@0
|
545 |
int32_t languageCapacity,
|
sl@0
|
546 |
UErrorCode* status);
|
sl@0
|
547 |
|
sl@0
|
548 |
/**
|
sl@0
|
549 |
* Gets the script name suitable for display for the specified locale.
|
sl@0
|
550 |
*
|
sl@0
|
551 |
* @param locale the locale to get the displayable script code with. NULL may be used to specify the default.
|
sl@0
|
552 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
553 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
554 |
* inLocale would result in "", while passing Locale::getGerman()
|
sl@0
|
555 |
* for inLocale would result in "". NULL may be used to specify the default.
|
sl@0
|
556 |
* @param script the displayable country code for localeID
|
sl@0
|
557 |
* @param scriptCapacity the size of the script buffer to store the
|
sl@0
|
558 |
* displayable script code with
|
sl@0
|
559 |
* @param status error information if retrieving the displayable script code failed
|
sl@0
|
560 |
* @return the actual buffer size needed for the displayable script code. If it's greater
|
sl@0
|
561 |
* than scriptCapacity, the returned displayable script code will be truncated.
|
sl@0
|
562 |
* @stable ICU 2.8
|
sl@0
|
563 |
*/
|
sl@0
|
564 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
565 |
uloc_getDisplayScript(const char* locale,
|
sl@0
|
566 |
const char* displayLocale,
|
sl@0
|
567 |
UChar* script,
|
sl@0
|
568 |
int32_t scriptCapacity,
|
sl@0
|
569 |
UErrorCode* status);
|
sl@0
|
570 |
|
sl@0
|
571 |
/**
|
sl@0
|
572 |
* Gets the country name suitable for display for the specified locale.
|
sl@0
|
573 |
*
|
sl@0
|
574 |
* @param locale the locale to get the displayable country code with. NULL may be used to specify the default.
|
sl@0
|
575 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
576 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
577 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
578 |
* for inLocale would result in "Englisch". NULL may be used to specify the default.
|
sl@0
|
579 |
* @param country the displayable country code for localeID
|
sl@0
|
580 |
* @param countryCapacity the size of the country buffer to store the
|
sl@0
|
581 |
* displayable country code with
|
sl@0
|
582 |
* @param status error information if retrieving the displayable country code failed
|
sl@0
|
583 |
* @return the actual buffer size needed for the displayable country code. If it's greater
|
sl@0
|
584 |
* than countryCapacity, the returned displayable country code will be truncated.
|
sl@0
|
585 |
* @stable ICU 2.0
|
sl@0
|
586 |
*/
|
sl@0
|
587 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
588 |
uloc_getDisplayCountry(const char* locale,
|
sl@0
|
589 |
const char* displayLocale,
|
sl@0
|
590 |
UChar* country,
|
sl@0
|
591 |
int32_t countryCapacity,
|
sl@0
|
592 |
UErrorCode* status);
|
sl@0
|
593 |
|
sl@0
|
594 |
|
sl@0
|
595 |
/**
|
sl@0
|
596 |
* Gets the variant name suitable for display for the specified locale.
|
sl@0
|
597 |
*
|
sl@0
|
598 |
* @param locale the locale to get the displayable variant code with. NULL may be used to specify the default.
|
sl@0
|
599 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
600 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
601 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
602 |
* for inLocale would result in "Englisch". NULL may be used to specify the default.
|
sl@0
|
603 |
* @param variant the displayable variant code for localeID
|
sl@0
|
604 |
* @param variantCapacity the size of the variant buffer to store the
|
sl@0
|
605 |
* displayable variant code with
|
sl@0
|
606 |
* @param status error information if retrieving the displayable variant code failed
|
sl@0
|
607 |
* @return the actual buffer size needed for the displayable variant code. If it's greater
|
sl@0
|
608 |
* than variantCapacity, the returned displayable variant code will be truncated.
|
sl@0
|
609 |
* @stable ICU 2.0
|
sl@0
|
610 |
*/
|
sl@0
|
611 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
612 |
uloc_getDisplayVariant(const char* locale,
|
sl@0
|
613 |
const char* displayLocale,
|
sl@0
|
614 |
UChar* variant,
|
sl@0
|
615 |
int32_t variantCapacity,
|
sl@0
|
616 |
UErrorCode* status);
|
sl@0
|
617 |
|
sl@0
|
618 |
/**
|
sl@0
|
619 |
* Gets the keyword name suitable for display for the specified locale.
|
sl@0
|
620 |
* E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
|
sl@0
|
621 |
* string for the keyword collation.
|
sl@0
|
622 |
* Usage:
|
sl@0
|
623 |
* <code>
|
sl@0
|
624 |
* UErrorCode status = U_ZERO_ERROR;
|
sl@0
|
625 |
* const char* keyword =NULL;
|
sl@0
|
626 |
* int32_t keywordLen = 0;
|
sl@0
|
627 |
* int32_t keywordCount = 0;
|
sl@0
|
628 |
* UChar displayKeyword[256];
|
sl@0
|
629 |
* int32_t displayKeywordLen = 0;
|
sl@0
|
630 |
* UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
|
sl@0
|
631 |
* for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
|
sl@0
|
632 |
* if(U_FAILURE(status)){
|
sl@0
|
633 |
* ...something went wrong so handle the error...
|
sl@0
|
634 |
* break;
|
sl@0
|
635 |
* }
|
sl@0
|
636 |
* // the uenum_next returns NUL terminated string
|
sl@0
|
637 |
* keyword = uenum_next(keywordEnum, &keywordLen, &status);
|
sl@0
|
638 |
* displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
|
sl@0
|
639 |
* ... do something interesting .....
|
sl@0
|
640 |
* }
|
sl@0
|
641 |
* uenum_close(keywordEnum);
|
sl@0
|
642 |
* </code>
|
sl@0
|
643 |
* @param keyword The keyword whose display string needs to be returned.
|
sl@0
|
644 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
645 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
646 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
647 |
* for inLocale would result in "Englisch". NULL may be used to specify the default.
|
sl@0
|
648 |
* @param dest the buffer to which the displayable keyword should be written.
|
sl@0
|
649 |
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
|
sl@0
|
650 |
* dest may be NULL and the function will only return the length of the
|
sl@0
|
651 |
* result without writing any of the result string (pre-flighting).
|
sl@0
|
652 |
* @param status error information if retrieving the displayable string failed.
|
sl@0
|
653 |
* Should not be NULL and should not indicate failure on entry.
|
sl@0
|
654 |
* @return the actual buffer size needed for the displayable variant code.
|
sl@0
|
655 |
* @see #uloc_openKeywords
|
sl@0
|
656 |
* @stable ICU 2.8
|
sl@0
|
657 |
*/
|
sl@0
|
658 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
659 |
uloc_getDisplayKeyword(const char* keyword,
|
sl@0
|
660 |
const char* displayLocale,
|
sl@0
|
661 |
UChar* dest,
|
sl@0
|
662 |
int32_t destCapacity,
|
sl@0
|
663 |
UErrorCode* status);
|
sl@0
|
664 |
/**
|
sl@0
|
665 |
* Gets the value of the keyword suitable for display for the specified locale.
|
sl@0
|
666 |
* E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
|
sl@0
|
667 |
* string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
|
sl@0
|
668 |
*
|
sl@0
|
669 |
* @param locale The locale to get the displayable variant code with. NULL may be used to specify the default.
|
sl@0
|
670 |
* @param keyword The keyword for whose value should be used.
|
sl@0
|
671 |
* @param displayLocale Specifies the locale to be used to display the name. In other words,
|
sl@0
|
672 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
673 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
674 |
* for inLocale would result in "Englisch". NULL may be used to specify the default.
|
sl@0
|
675 |
* @param dest the buffer to which the displayable keyword should be written.
|
sl@0
|
676 |
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
|
sl@0
|
677 |
* dest may be NULL and the function will only return the length of the
|
sl@0
|
678 |
* result without writing any of the result string (pre-flighting).
|
sl@0
|
679 |
* @param status error information if retrieving the displayable string failed.
|
sl@0
|
680 |
* Should not be NULL and must not indicate failure on entry.
|
sl@0
|
681 |
* @return the actual buffer size needed for the displayable variant code.
|
sl@0
|
682 |
* @stable ICU 2.8
|
sl@0
|
683 |
*/
|
sl@0
|
684 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
685 |
uloc_getDisplayKeywordValue( const char* locale,
|
sl@0
|
686 |
const char* keyword,
|
sl@0
|
687 |
const char* displayLocale,
|
sl@0
|
688 |
UChar* dest,
|
sl@0
|
689 |
int32_t destCapacity,
|
sl@0
|
690 |
UErrorCode* status);
|
sl@0
|
691 |
/**
|
sl@0
|
692 |
* Gets the full name suitable for display for the specified locale.
|
sl@0
|
693 |
*
|
sl@0
|
694 |
* @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
|
sl@0
|
695 |
* @param inLocaleID Specifies the locale to be used to display the name. In other words,
|
sl@0
|
696 |
* if the locale's language code is "en", passing Locale::getFrench() for
|
sl@0
|
697 |
* inLocale would result in "Anglais", while passing Locale::getGerman()
|
sl@0
|
698 |
* for inLocale would result in "Englisch". NULL may be used to specify the default.
|
sl@0
|
699 |
* @param result the displayable name for localeID
|
sl@0
|
700 |
* @param maxResultSize the size of the name buffer to store the
|
sl@0
|
701 |
* displayable full name with
|
sl@0
|
702 |
* @param err error information if retrieving the displayable name failed
|
sl@0
|
703 |
* @return the actual buffer size needed for the displayable name. If it's greater
|
sl@0
|
704 |
* than maxResultSize, the returned displayable name will be truncated.
|
sl@0
|
705 |
* @stable ICU 2.0
|
sl@0
|
706 |
*/
|
sl@0
|
707 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
708 |
uloc_getDisplayName(const char* localeID,
|
sl@0
|
709 |
const char* inLocaleID,
|
sl@0
|
710 |
UChar* result,
|
sl@0
|
711 |
int32_t maxResultSize,
|
sl@0
|
712 |
UErrorCode* err);
|
sl@0
|
713 |
|
sl@0
|
714 |
|
sl@0
|
715 |
/**
|
sl@0
|
716 |
* Gets the specified locale from a list of all available locales.
|
sl@0
|
717 |
* The return value is a pointer to an item of
|
sl@0
|
718 |
* a locale name array. Both this array and the pointers
|
sl@0
|
719 |
* it contains are owned by ICU and should not be deleted or written through
|
sl@0
|
720 |
* by the caller. The locale name is terminated by a null pointer.
|
sl@0
|
721 |
* @param n the specific locale name index of the available locale list
|
sl@0
|
722 |
* @return a specified locale name of all available locales
|
sl@0
|
723 |
* @stable ICU 2.0
|
sl@0
|
724 |
*/
|
sl@0
|
725 |
U_STABLE const char* U_EXPORT2
|
sl@0
|
726 |
uloc_getAvailable(int32_t n);
|
sl@0
|
727 |
|
sl@0
|
728 |
/**
|
sl@0
|
729 |
* Gets the size of the all available locale list.
|
sl@0
|
730 |
*
|
sl@0
|
731 |
* @return the size of the locale list
|
sl@0
|
732 |
* @stable ICU 2.0
|
sl@0
|
733 |
*/
|
sl@0
|
734 |
U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
|
sl@0
|
735 |
|
sl@0
|
736 |
/**
|
sl@0
|
737 |
*
|
sl@0
|
738 |
* Gets a list of all available language codes defined in ISO 639. This is a pointer
|
sl@0
|
739 |
* to an array of pointers to arrays of char. All of these pointers are owned
|
sl@0
|
740 |
* by ICU-- do not delete them, and do not write through them. The array is
|
sl@0
|
741 |
* terminated with a null pointer.
|
sl@0
|
742 |
* @return a list of all available language codes
|
sl@0
|
743 |
* @stable ICU 2.0
|
sl@0
|
744 |
*/
|
sl@0
|
745 |
U_STABLE const char* const* U_EXPORT2
|
sl@0
|
746 |
uloc_getISOLanguages(void);
|
sl@0
|
747 |
|
sl@0
|
748 |
/**
|
sl@0
|
749 |
*
|
sl@0
|
750 |
* Gets a list of all available 2-letter country codes defined in ISO 639. This is a
|
sl@0
|
751 |
* pointer to an array of pointers to arrays of char. All of these pointers are
|
sl@0
|
752 |
* owned by ICU-- do not delete them, and do not write through them. The array is
|
sl@0
|
753 |
* terminated with a null pointer.
|
sl@0
|
754 |
* @return a list of all available country codes
|
sl@0
|
755 |
* @stable ICU 2.0
|
sl@0
|
756 |
*/
|
sl@0
|
757 |
U_STABLE const char* const* U_EXPORT2
|
sl@0
|
758 |
uloc_getISOCountries(void);
|
sl@0
|
759 |
|
sl@0
|
760 |
/**
|
sl@0
|
761 |
* Truncate the locale ID string to get the parent locale ID.
|
sl@0
|
762 |
* Copies the part of the string before the last underscore.
|
sl@0
|
763 |
* The parent locale ID will be an empty string if there is no
|
sl@0
|
764 |
* underscore, or if there is only one underscore at localeID[0].
|
sl@0
|
765 |
*
|
sl@0
|
766 |
* @param localeID Input locale ID string.
|
sl@0
|
767 |
* @param parent Output string buffer for the parent locale ID.
|
sl@0
|
768 |
* @param parentCapacity Size of the output buffer.
|
sl@0
|
769 |
* @param err A UErrorCode value.
|
sl@0
|
770 |
* @return The length of the parent locale ID.
|
sl@0
|
771 |
* @stable ICU 2.0
|
sl@0
|
772 |
*/
|
sl@0
|
773 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
774 |
uloc_getParent(const char* localeID,
|
sl@0
|
775 |
char* parent,
|
sl@0
|
776 |
int32_t parentCapacity,
|
sl@0
|
777 |
UErrorCode* err);
|
sl@0
|
778 |
|
sl@0
|
779 |
|
sl@0
|
780 |
|
sl@0
|
781 |
|
sl@0
|
782 |
/**
|
sl@0
|
783 |
* Gets the full name for the specified locale.
|
sl@0
|
784 |
* Note: This has the effect of 'canonicalizing' the string to
|
sl@0
|
785 |
* a certain extent. Upper and lower case are set as needed,
|
sl@0
|
786 |
* and if the components were in 'POSIX' format they are changed to
|
sl@0
|
787 |
* ICU format. It does NOT map aliased names in any way.
|
sl@0
|
788 |
* See the top of this header file.
|
sl@0
|
789 |
* This API strips off the keyword part, so "de_DE\@collation=phonebook"
|
sl@0
|
790 |
* will become "de_DE".
|
sl@0
|
791 |
* This API supports preflighting.
|
sl@0
|
792 |
*
|
sl@0
|
793 |
* @param localeID the locale to get the full name with
|
sl@0
|
794 |
* @param name fill in buffer for the name without keywords.
|
sl@0
|
795 |
* @param nameCapacity capacity of the fill in buffer.
|
sl@0
|
796 |
* @param err error information if retrieving the full name failed
|
sl@0
|
797 |
* @return the actual buffer size needed for the full name. If it's greater
|
sl@0
|
798 |
* than nameCapacity, the returned full name will be truncated.
|
sl@0
|
799 |
* @stable ICU 2.8
|
sl@0
|
800 |
*/
|
sl@0
|
801 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
802 |
uloc_getBaseName(const char* localeID,
|
sl@0
|
803 |
char* name,
|
sl@0
|
804 |
int32_t nameCapacity,
|
sl@0
|
805 |
UErrorCode* err);
|
sl@0
|
806 |
|
sl@0
|
807 |
/**
|
sl@0
|
808 |
* Gets an enumeration of keywords for the specified locale. Enumeration
|
sl@0
|
809 |
* must get disposed of by the client using uenum_close function.
|
sl@0
|
810 |
*
|
sl@0
|
811 |
* @param localeID the locale to get the variant code with
|
sl@0
|
812 |
* @param status error information if retrieving the keywords failed
|
sl@0
|
813 |
* @return enumeration of keywords or NULL if there are no keywords.
|
sl@0
|
814 |
* @stable ICU 2.8
|
sl@0
|
815 |
*/
|
sl@0
|
816 |
U_STABLE UEnumeration* U_EXPORT2
|
sl@0
|
817 |
uloc_openKeywords(const char* localeID,
|
sl@0
|
818 |
UErrorCode* status);
|
sl@0
|
819 |
|
sl@0
|
820 |
/**
|
sl@0
|
821 |
* Get the value for a keyword. Locale name does not need to be normalized.
|
sl@0
|
822 |
*
|
sl@0
|
823 |
* @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
|
sl@0
|
824 |
* @param keywordName name of the keyword for which we want the value. Case insensitive.
|
sl@0
|
825 |
* @param buffer receiving buffer
|
sl@0
|
826 |
* @param bufferCapacity capacity of receiving buffer
|
sl@0
|
827 |
* @param status containing error code - buffer not big enough.
|
sl@0
|
828 |
* @return the length of keyword value
|
sl@0
|
829 |
* @stable ICU 2.8
|
sl@0
|
830 |
*/
|
sl@0
|
831 |
U_STABLE int32_t U_EXPORT2
|
sl@0
|
832 |
uloc_getKeywordValue(const char* localeID,
|
sl@0
|
833 |
const char* keywordName,
|
sl@0
|
834 |
char* buffer, int32_t bufferCapacity,
|
sl@0
|
835 |
UErrorCode* status);
|
sl@0
|
836 |
|
sl@0
|
837 |
|
sl@0
|
838 |
/**
|
sl@0
|
839 |
* Set the value of the specified keyword.
|
sl@0
|
840 |
* NOTE: Unlike almost every other ICU function which takes a
|
sl@0
|
841 |
* buffer, this function will NOT truncate the output text. If a
|
sl@0
|
842 |
* BUFFER_OVERFLOW_ERROR is received, it means that the original
|
sl@0
|
843 |
* buffer is untouched. This is done to prevent incorrect or possibly
|
sl@0
|
844 |
* even malformed locales from being generated and used.
|
sl@0
|
845 |
*
|
sl@0
|
846 |
* @param keywordName name of the keyword to be set. Case insensitive.
|
sl@0
|
847 |
* @param keywordValue value of the keyword to be set. If 0-length or
|
sl@0
|
848 |
* NULL, will result in the keyword being removed. No error is given if
|
sl@0
|
849 |
* that keyword does not exist.
|
sl@0
|
850 |
* @param buffer input buffer containing locale to be modified.
|
sl@0
|
851 |
* @param bufferCapacity capacity of receiving buffer
|
sl@0
|
852 |
* @param status containing error code - buffer not big enough.
|
sl@0
|
853 |
* @return the length needed for the buffer
|
sl@0
|
854 |
* @see uloc_getKeywordValue
|
sl@0
|
855 |
* @draft ICU 3.2
|
sl@0
|
856 |
*/
|
sl@0
|
857 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
858 |
uloc_setKeywordValue(const char* keywordName,
|
sl@0
|
859 |
const char* keywordValue,
|
sl@0
|
860 |
char* buffer, int32_t bufferCapacity,
|
sl@0
|
861 |
UErrorCode* status);
|
sl@0
|
862 |
|
sl@0
|
863 |
/**
|
sl@0
|
864 |
* enums for the 'outResult' parameter return value
|
sl@0
|
865 |
* @see uloc_acceptLanguageFromHTTP
|
sl@0
|
866 |
* @see uloc_acceptLanguage
|
sl@0
|
867 |
* @draft ICU 3.2
|
sl@0
|
868 |
*/
|
sl@0
|
869 |
typedef enum {
|
sl@0
|
870 |
ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
|
sl@0
|
871 |
ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
|
sl@0
|
872 |
ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
|
sl@0
|
873 |
Accept list contained 'ja_JP'
|
sl@0
|
874 |
which matched available locale 'ja'. */
|
sl@0
|
875 |
} UAcceptResult;
|
sl@0
|
876 |
|
sl@0
|
877 |
|
sl@0
|
878 |
/**
|
sl@0
|
879 |
* Based on a HTTP header from a web browser and a list of available locales,
|
sl@0
|
880 |
* determine an acceptable locale for the user.
|
sl@0
|
881 |
* @param result - buffer to accept the result locale
|
sl@0
|
882 |
* @param resultAvailable the size of the result buffer.
|
sl@0
|
883 |
* @param outResult - An out parameter that contains the fallback status
|
sl@0
|
884 |
* @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
|
sl@0
|
885 |
* @param availableLocales - list of available locales to match
|
sl@0
|
886 |
* @param status Error status, may be BUFFER_OVERFLOW_ERROR
|
sl@0
|
887 |
* @return length needed for the locale.
|
sl@0
|
888 |
* @draft ICU 3.2
|
sl@0
|
889 |
*/
|
sl@0
|
890 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
891 |
uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
|
sl@0
|
892 |
UAcceptResult *outResult,
|
sl@0
|
893 |
const char *httpAcceptLanguage,
|
sl@0
|
894 |
UEnumeration* availableLocales,
|
sl@0
|
895 |
UErrorCode *status);
|
sl@0
|
896 |
|
sl@0
|
897 |
/**
|
sl@0
|
898 |
* Based on a list of available locales,
|
sl@0
|
899 |
* determine an acceptable locale for the user.
|
sl@0
|
900 |
* @param result - buffer to accept the result locale
|
sl@0
|
901 |
* @param resultAvailable the size of the result buffer.
|
sl@0
|
902 |
* @param outResult - An out parameter that contains the fallback status
|
sl@0
|
903 |
* @param acceptList - list of acceptable languages
|
sl@0
|
904 |
* @param acceptListCount - count of acceptList items
|
sl@0
|
905 |
* @param availableLocales - list of available locales to match
|
sl@0
|
906 |
* @param status Error status, may be BUFFER_OVERFLOW_ERROR
|
sl@0
|
907 |
* @return length needed for the locale.
|
sl@0
|
908 |
* @draft ICU 3.2
|
sl@0
|
909 |
*/
|
sl@0
|
910 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
911 |
uloc_acceptLanguage(char *result, int32_t resultAvailable,
|
sl@0
|
912 |
UAcceptResult *outResult, const char **acceptList,
|
sl@0
|
913 |
int32_t acceptListCount,
|
sl@0
|
914 |
UEnumeration* availableLocales,
|
sl@0
|
915 |
UErrorCode *status);
|
sl@0
|
916 |
|
sl@0
|
917 |
|
sl@0
|
918 |
#endif /*_ULOC*/
|
sl@0
|
919 |
|
sl@0
|
920 |
|