1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_NTLOCALE_H
27 #define	_SMBSRV_NTLOCALE_H
28 
29 /*
30  * NT language and locale identifiers.
31  */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
38 /*
39  * Language IDs.
40  *
41  * A language ID is a 16 bit value which is the combination of a
42  * primary language ID and a secondary language ID. The bits are
43  * allocated as follows:
44  *
45  *      +-----------------------+-------------------------+
46  *      |     Sublanguage ID    |   Primary Language ID   |
47  *      +-----------------------+-------------------------+
48  *       15                   10 9                       0   bit
49  *
50  * The following two combinations of primary language ID and sub-
51  * language ID have special semantics:
52  *
53  * Primary Language ID   Sublanguage ID      Result
54  * -------------------   ---------------     ------------------------
55  * LANG_NEUTRAL          SUBLANG_NEUTRAL     Language neutral
56  * LANG_NEUTRAL          SUBLANG_DEFAULT     User default language
57  * LANG_NEUTRAL          SUBLANG_SYS_DEFAULT System default language
58  *
59  * Language ID creation/extraction macros:
60  * MAKELANGID    - construct language id from a primary language
61  *                 id and a sublanguage id.
62  * PRIMARYLANGID - extract primary language id from a language id.
63  * SUBLANGID     - extract sublanguage id from a language id.
64  */
65 #define	MAKELANGID(p, s)	((((WORD)(s)) << 10) | (WORD)(p))
66 #define	PRIMARYLANGID(lgid)	((WORD)(lgid) & 0x3ff)
67 #define	SUBLANGID(lgid)		((WORD)(lgid) >> 10)
68 
69 
70 /*
71  * Primary language IDs.
72  */
73 #define	LANG_NEUTRAL			0x00
74 
75 #define	LANG_AFRIKAANS			0x36
76 #define	LANG_ALBANIAN			0x1c
77 #define	LANG_ARABIC			0x01
78 #define	LANG_ARMENIAN			0x2b
79 #define	LANG_ASSAMESE			0x4d
80 #define	LANG_AZERI			0x2c
81 #define	LANG_BASQUE			0x2d
82 #define	LANG_BELARUSIAN			0x23
83 #define	LANG_BENGALI			0x45
84 #define	LANG_BULGARIAN			0x02
85 #define	LANG_CATALAN			0x03
86 #define	LANG_CHINESE			0x04
87 #define	LANG_CROATIAN			0x1a
88 #define	LANG_CZECH			0x05
89 #define	LANG_DANISH			0x06
90 #define	LANG_DUTCH			0x13
91 #define	LANG_ENGLISH			0x09
92 #define	LANG_ESTONIAN			0x25
93 #define	LANG_FAEROESE			0x38
94 #define	LANG_FARSI			0x29
95 #define	LANG_FINNISH			0x0b
96 #define	LANG_FRENCH			0x0c
97 #define	LANG_GEORGIAN			0x37
98 #define	LANG_GERMAN			0x07
99 #define	LANG_GREEK			0x08
100 #define	LANG_GUJARATI			0x47
101 #define	LANG_HEBREW			0x0d
102 #define	LANG_HINDI			0x39
103 #define	LANG_HUNGARIAN			0x0e
104 #define	LANG_ICELANDIC			0x0f
105 #define	LANG_INDONESIAN			0x21
106 #define	LANG_ITALIAN			0x10
107 #define	LANG_JAPANESE			0x11
108 #define	LANG_KANNADA			0x4b
109 #define	LANG_KASHMIRI			0x60
110 #define	LANG_KAZAK			0x3f
111 #define	LANG_KONKANI			0x57
112 #define	LANG_KOREAN			0x12
113 #define	LANG_LATVIAN			0x26
114 #define	LANG_LITHUANIAN			0x27
115 #define	LANG_MACEDONIAN			0x2f
116 #define	LANG_MALAY			0x3e
117 #define	LANG_MALAYALAM			0x4c
118 #define	LANG_MANIPURI			0x58
119 #define	LANG_MARATHI			0x4e
120 #define	LANG_NEPALI			0x61
121 #define	LANG_NORWEGIAN			0x14
122 #define	LANG_ORIYA			0x48
123 #define	LANG_POLISH			0x15
124 #define	LANG_PORTUGUESE			0x16
125 #define	LANG_PUNJABI			0x46
126 #define	LANG_ROMANIAN			0x18
127 #define	LANG_RUSSIAN			0x19
128 #define	LANG_SANSKRIT			0x4f
129 #define	LANG_SERBIAN			0x1a
130 #define	LANG_SINDHI			0x59
131 #define	LANG_SLOVAK			0x1b
132 #define	LANG_SLOVENIAN			0x24
133 #define	LANG_SPANISH			0x0a
134 #define	LANG_SWAHILI			0x41
135 #define	LANG_SWEDISH			0x1d
136 #define	LANG_TAMIL			0x49
137 #define	LANG_TATAR			0x44
138 #define	LANG_TELUGU			0x4a
139 #define	LANG_THAI			0x1e
140 #define	LANG_TURKISH			0x1f
141 #define	LANG_UKRAINIAN			0x22
142 #define	LANG_URDU			0x20
143 #define	LANG_UZBEK			0x43
144 #define	LANG_VIETNAMESE			0x2a
145 
146 
147 /*
148  * Sublanguage IDs.
149  *
150  * The name immediately following SUBLANG_ dictates which primary
151  * language ID can be combined with the sub-language ID to form a
152  * valid language ID.
153  */
154 #define	SUBLANG_NEUTRAL			0x00	/* language neutral */
155 #define	SUBLANG_DEFAULT			0x01	/* user default */
156 #define	SUBLANG_SYS_DEFAULT		0x02	/* system default */
157 
158 #define	SUBLANG_ARABIC_SAUDI_ARABIA	0x01	/* Arabic (Saudi Arabia) */
159 #define	SUBLANG_ARABIC_IRAQ		0x02	/* Arabic (Iraq) */
160 #define	SUBLANG_ARABIC_EGYPT		0x03	/* Arabic (Egypt) */
161 #define	SUBLANG_ARABIC_LIBYA		0x04	/* Arabic (Libya) */
162 #define	SUBLANG_ARABIC_ALGERIA		0x05	/* Arabic (Algeria) */
163 #define	SUBLANG_ARABIC_MOROCCO		0x06	/* Arabic (Morocco) */
164 #define	SUBLANG_ARABIC_TUNISIA		0x07	/* Arabic (Tunisia) */
165 #define	SUBLANG_ARABIC_OMAN		0x08	/* Arabic (Oman) */
166 #define	SUBLANG_ARABIC_YEMEN		0x09	/* Arabic (Yemen) */
167 #define	SUBLANG_ARABIC_SYRIA		0x0a	/* Arabic (Syria) */
168 #define	SUBLANG_ARABIC_JORDAN		0x0b	/* Arabic (Jordan) */
169 #define	SUBLANG_ARABIC_LEBANON		0x0c	/* Arabic (Lebanon) */
170 #define	SUBLANG_ARABIC_KUWAIT		0x0d	/* Arabic (Kuwait) */
171 #define	SUBLANG_ARABIC_UAE		0x0e	/* Arabic (U.A.E) */
172 #define	SUBLANG_ARABIC_BAHRAIN		0x0f	/* Arabic (Bahrain) */
173 #define	SUBLANG_ARABIC_QATAR		0x10	/* Arabic (Qatar) */
174 #define	SUBLANG_AZERI_LATIN		0x01	/* Azeri (Latin) */
175 #define	SUBLANG_AZERI_CYRILLIC		0x02	/* Azeri (Cyrillic) */
176 #define	SUBLANG_CHINESE_TRADITIONAL	0x01	/* Chinese (Taiwan Region) */
177 #define	SUBLANG_CHINESE_SIMPLIFIED	0x02	/* Chinese (PR China) */
178 #define	SUBLANG_CHINESE_HONGKONG	0x03	/* Chinese (Hong Kong) */
179 #define	SUBLANG_CHINESE_SINGAPORE	0x04	/* Chinese (Singapore) */
180 #define	SUBLANG_CHINESE_MACAU		0x05	/* Chinese (Macau) */
181 #define	SUBLANG_DUTCH			0x01	/* Dutch */
182 #define	SUBLANG_DUTCH_BELGIAN		0x02	/* Dutch (Belgian) */
183 #define	SUBLANG_ENGLISH_US		0x01	/* English (USA) */
184 #define	SUBLANG_ENGLISH_UK		0x02	/* English (UK) */
185 #define	SUBLANG_ENGLISH_AUS		0x03	/* English (Australian) */
186 #define	SUBLANG_ENGLISH_CAN		0x04	/* English (Canadian) */
187 #define	SUBLANG_ENGLISH_NZ		0x05	/* English (New Zealand) */
188 #define	SUBLANG_ENGLISH_EIRE		0x06	/* English (Irish) */
189 #define	SUBLANG_ENGLISH_SOUTH_AFRICA	0x07	/* English (South Africa) */
190 #define	SUBLANG_ENGLISH_JAMAICA		0x08	/* English (Jamaica) */
191 #define	SUBLANG_ENGLISH_CARIBBEAN	0x09	/* English (Caribbean) */
192 #define	SUBLANG_ENGLISH_BELIZE		0x0a	/* English (Belize) */
193 #define	SUBLANG_ENGLISH_TRINIDAD	0x0b	/* English (Trinidad) */
194 #define	SUBLANG_ENGLISH_ZIMBABWE	0x0c	/* English (Zimbabwe) */
195 #define	SUBLANG_ENGLISH_PHILIPPINES	0x0d	/* English (Philippines) */
196 #define	SUBLANG_FRENCH			0x01	/* French */
197 #define	SUBLANG_FRENCH_BELGIAN		0x02	/* French (Belgian) */
198 #define	SUBLANG_FRENCH_CANADIAN		0x03	/* French (Canadian) */
199 #define	SUBLANG_FRENCH_SWISS		0x04	/* French (Swiss) */
200 #define	SUBLANG_FRENCH_LUXEMBOURG	0x05	/* French (Luxembourg) */
201 #define	SUBLANG_FRENCH_MONACO		0x06	/* French (Monaco) */
202 #define	SUBLANG_GERMAN			0x01	/* German */
203 #define	SUBLANG_GERMAN_SWISS		0x02	/* German (Swiss) */
204 #define	SUBLANG_GERMAN_AUSTRIAN		0x03	/* German (Austrian) */
205 #define	SUBLANG_GERMAN_LUXEMBOURG	0x04	/* German (Luxembourg) */
206 #define	SUBLANG_GERMAN_LIECHTENSTEIN	0x05	/* German (Liechtenstein) */
207 #define	SUBLANG_ITALIAN			0x01	/* Italian */
208 #define	SUBLANG_ITALIAN_SWISS		0x02	/* Italian (Swiss) */
209 #define	SUBLANG_KASHMIRI_INDIA		0x02	/* Kashmiri (India) */
210 #define	SUBLANG_KOREAN			0x01	/* Korean (Extended Wansung) */
211 #define	SUBLANG_LITHUANIAN		0x01	/* Lithuanian */
212 #define	SUBLANG_LITHUANIAN_CLASSIC	0x02	/* Lithuanian (Classic) */
213 #define	SUBLANG_MALAY_MALAYSIA		0x01	/* Malay (Malaysia) */
214 #define	SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02	/* Malay (Brunei Darussalam) */
215 #define	SUBLANG_NEPALI_INDIA		0x02	/* Nepali (India) */
216 #define	SUBLANG_NORWEGIAN_BOKMAL	0x01	/* Norwegian (Bokmal) */
217 #define	SUBLANG_NORWEGIAN_NYNORSK	0x02	/* Norwegian (Nynorsk) */
218 #define	SUBLANG_PORTUGUESE		0x02	/* Portuguese */
219 #define	SUBLANG_PORTUGUESE_BRAZILIAN	0x01	/* Portuguese (Brazilian) */
220 #define	SUBLANG_SERBIAN_LATIN		0x02	/* Serbian (Latin) */
221 #define	SUBLANG_SERBIAN_CYRILLIC	0x03	/* Serbian (Cyrillic) */
222 #define	SUBLANG_SPANISH			0x01	/* Spanish (Castilian) */
223 #define	SUBLANG_SPANISH_MEXICAN		0x02	/* Spanish (Mexican) */
224 #define	SUBLANG_SPANISH_MODERN		0x03	/* Spanish (Modern) */
225 #define	SUBLANG_SPANISH_GUATEMALA	0x04	/* Spanish (Guatemala) */
226 #define	SUBLANG_SPANISH_COSTA_RICA	0x05	/* Spanish (Costa Rica) */
227 #define	SUBLANG_SPANISH_PANAMA		0x06	/* Spanish (Panama) */
228 #define	SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07	/* Spanish (Dom. Republic) */
229 #define	SUBLANG_SPANISH_VENEZUELA	0x08	/* Spanish (Venezuela) */
230 #define	SUBLANG_SPANISH_COLOMBIA	0x09	/* Spanish (Colombia) */
231 #define	SUBLANG_SPANISH_PERU		0x0a	/* Spanish (Peru) */
232 #define	SUBLANG_SPANISH_ARGENTINA	0x0b	/* Spanish (Argentina) */
233 #define	SUBLANG_SPANISH_ECUADOR		0x0c	/* Spanish (Ecuador) */
234 #define	SUBLANG_SPANISH_CHILE		0x0d	/* Spanish (Chile) */
235 #define	SUBLANG_SPANISH_URUGUAY		0x0e	/* Spanish (Uruguay) */
236 #define	SUBLANG_SPANISH_PARAGUAY	0x0f	/* Spanish (Paraguay) */
237 #define	SUBLANG_SPANISH_BOLIVIA		0x10	/* Spanish (Bolivia) */
238 #define	SUBLANG_SPANISH_EL_SALVADOR	0x11	/* Spanish (El Salvador) */
239 #define	SUBLANG_SPANISH_HONDURAS	0x12	/* Spanish (Honduras) */
240 #define	SUBLANG_SPANISH_NICARAGUA	0x13	/* Spanish (Nicaragua) */
241 #define	SUBLANG_SPANISH_PUERTO_RICO	0x14	/* Spanish (Puerto Rico) */
242 #define	SUBLANG_SWEDISH			0x01	/* Swedish */
243 #define	SUBLANG_SWEDISH_FINLAND		0x02	/* Swedish (Finland) */
244 #define	SUBLANG_URDU_PAKISTAN		0x01	/* Urdu (Pakistan) */
245 #define	SUBLANG_URDU_INDIA		0x02	/* Urdu (India) */
246 #define	SUBLANG_UZBEK_LATIN		0x01	/* Uzbek (Latin) */
247 #define	SUBLANG_UZBEK_CYRILLIC		0x02	/* Uzbek (Cyrillic) */
248 
249 /*
250  * Sorting IDs.
251  */
252 #define	SORT_DEFAULT			0x0	/* sorting default */
253 
254 #define	SORT_JAPANESE_XJIS		0x0	/* Japanese XJIS order */
255 #define	SORT_JAPANESE_UNICODE		0x1	/* Japanese Unicode order */
256 
257 #define	SORT_CHINESE_BIG5		0x0	/* Chinese BIG5 order */
258 #define	SORT_CHINESE_PRCP		0x0	/* PRC Chinese Phonetic order */
259 #define	SORT_CHINESE_UNICODE		0x1	/* Chinese Unicode order */
260 #define	SORT_CHINESE_PRC		0x2	/* PRC Chinese Stroke Count */
261 						/* order */
262 #define	SORT_CHINESE_BOPOMOFO		0x3	/* Traditional Chinese */
263 						/* Bopomofo order */
264 
265 #define	SORT_KOREAN_KSC			0x0	/* Korean KSC order */
266 #define	SORT_KOREAN_UNICODE		0x1	/* Korean Unicode order */
267 
268 #define	SORT_GERMAN_PHONE_BOOK		0x1	/* German Phone Book order */
269 
270 #define	SORT_HUNGARIAN_DEFAULT		0x0	/* Hungarian Default order */
271 #define	SORT_HUNGARIAN_TECHNICAL	0x1	/* Hungarian Technical order */
272 
273 #define	SORT_GEORGIAN_TRADITIONAL	0x0	/* Georgian Traditional order */
274 #define	SORT_GEORGIAN_MODERN		0x1	/* Georgian Modern order */
275 
276 
277 /*
278  *  A locale ID is a 32 bit value which is the combination of a
279  *  language ID, a sort ID, and a reserved area.  The bits are
280  *  allocated as follows:
281  *
282  *       +-------------+---------+-------------------------+
283  *       |   Reserved  | Sort ID |      Language ID        |
284  *       +-------------+---------+-------------------------+
285  *        31         20 19     16 15                      0   bit
286  *
287  *  Locale ID creation/extraction macros:
288  *
289  * MAKELCID            - construct the locale id from a language id
290  *                       and a sort id.
291  * MAKESORTLCID        - construct the locale id from a language id,
292  *                       sort id, and sort version.
293  * LANGIDFROMLCID      - extract the language id from a locale id.
294  * SORTIDFROMLCID      - extract the sort id from a locale id.
295  * SORTVERSIONFROMLCID - extract the sort version from a locale id.
296  */
297 
298 #define	NLS_VALID_LOCALE_MASK	0x000fffff
299 
300 #define	MAKELCID(lgid, srtid)	\
301 	((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid)))))
302 
303 #define	MAKESORTLCID(lgid, srtid, ver)	\
304 	((DWORD)((MAKELCID(lgid, srtid)) | (((DWORD)((WORD)(ver))) << 20)))
305 
306 #define	LANGIDFROMLCID(lcid)		((WORD)(lcid))
307 #define	SORTIDFROMLCID(lcid)		((WORD)((((DWORD)(lcid)) >> 16) & 0xf))
308 #define	SORTVERSIONFROMLCID(lcid)	((WORD)((((DWORD)(lcid)) >> 20) & 0xf))
309 
310 
311 /*
312  * Default System and User IDs for language and locale.
313  */
314 #define	LANG_SYSTEM_DEFAULT	MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
315 #define	LANG_USER_DEFAULT	(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
316 
317 #define	LOCALE_SYSTEM_DEFAULT	(MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
318 #define	LOCALE_USER_DEFAULT	(MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
319 
320 #define	LOCALE_NEUTRAL         \
321 	(MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT))
322 
323 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #endif /* _SMBSRV_NTLOCALE_H */
329