update dev300-m58
[ooovba.git] / shell / source / win32 / shlxthandler / util / utilities.cxx
blobd76e0c9df7740b0ee71bf263e9f175c905c257f9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: utilities.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_shell.hxx"
35 #include "internal/utilities.hxx"
36 #include "internal/config.hxx"
37 #include "internal/dbgmacros.hxx"
42 //-----------------------------
43 // constants
44 //-----------------------------
46 const size_t MAX_RES_STRING = 1024;
47 const wchar_t SPACE_CHAR = _T(' ');
49 //---------------------------------
50 /**
52 std::wstring StringToWString(const std::string& String)
54 int len = MultiByteToWideChar(
55 CP_ACP, 0, String.c_str(), -1, 0, 0);
57 wchar_t* buff = reinterpret_cast<wchar_t*>(
58 _alloca(len * sizeof(wchar_t)));
60 MultiByteToWideChar(
61 CP_ACP, 0, String.c_str(), -1, buff, len);
63 return std::wstring(buff);
66 //---------------------------------
67 /**
69 std::string WStringToString(const std::wstring& String)
71 int len = WideCharToMultiByte(
72 CP_ACP, 0, String.c_str(), -1, 0, 0, 0, 0);
74 char* buff = reinterpret_cast<char*>(
75 _alloca(len * sizeof(char)));
77 WideCharToMultiByte(
78 CP_ACP, 0, String.c_str(), -1, buff, len, 0, 0);
80 return std::string(buff);
83 //---------------------------------
84 /**
86 std::wstring GetResString(int ResId)
88 wchar_t szResStr[MAX_RES_STRING];
90 #if OSL_DEBUG_LEVEL > 0
91 int rc =
92 #endif
93 LoadStringW(
94 GetModuleHandleW(MODULE_NAME),
95 ResId,
96 szResStr,
97 sizeof(szResStr));
99 ENSURE(rc, "String resource not found");
101 return std::wstring(szResStr);
104 //---------------------------------
107 bool is_windows_xp_or_above()
109 OSVERSIONINFO osvi;
110 ZeroMemory(&osvi, sizeof(osvi));
111 osvi.dwOSVersionInfoSize = sizeof(osvi);
112 GetVersionEx(&osvi);
114 // LLA: check for windows xp or above (Vista)
115 if (osvi.dwMajorVersion > 5 ||
116 (5 == osvi.dwMajorVersion && osvi.dwMinorVersion >= 1))
118 return true;
120 return false;
123 //---------------------------------
127 void SaveDebugInfoToFile( const std::wstring& str )
129 int handle;
131 if ((handle = open("c:\\temp\\SHELLRESULT.$$$", O_CREAT | O_RDWR | O_APPEND )) == -1)
133 perror("Error: open file error");
134 return;
136 write(handle, str.c_str(), str.length() );
137 close(handle);
140 //---------------------------------
141 /** helper function to judge if the string is only has spaces.
142 @returns
143 <TRUE>if the provided string contains only but at least one space
144 character else <FALSE/>.
147 bool HasOnlySpaces(const std::wstring& String)
149 if ( String.length() == 0 )
150 return false;
152 const wchar_t* p = String.c_str();
154 while (*p)
156 if (*p++ != SPACE_CHAR)
157 return false;
160 return true;
163 /** convert LocaleSet pair into Microsoft List of Locale ID (LCID)
164 according to ISO-639 and ISO-3166.
165 http://etext.lib.virginia.edu/tei/iso639.html
166 http://nl.ijs.si/gnusl/cee/std/ISO_3166.html
167 @param
168 Locale, LocaleSet
169 @returns
170 Windows Locale Identifier corresponding to input LocaleSet.
171 @Usage Sample
172 LocaleSet_t myDefaultLocale( ::std::wstring( L"zh" ),::std::wstring(L"HK") );
173 DWORD myLCID = LocaleSetToLCID( myDefaultLocale );
174 wchar_t buffer[20];
175 _ultow( myLCID, buffer, 16 );
176 MessageBox( NULL, buffer,L"the LCID is:",MB_OK );
179 LCID LocaleSetToLCID( const LocaleSet_t & Locale )
181 if ( EMPTY_LOCALE == Locale )
182 return GetSystemDefaultLCID();
184 USHORT usPrimaryLang= LANG_NEUTRAL;
185 USHORT usSubLang=SUBLANG_DEFAULT;
187 ::std::wstring wsLanguage(Locale.first);
188 ::std::wstring wsCountry(Locale.second);
190 if ( wsLanguage == L"ar" )
192 usPrimaryLang = LANG_ARABIC; // Arabic 01
194 if ( wsCountry == L"SA" )
195 usSubLang = SUBLANG_ARABIC_SAUDI_ARABIA; // Arabic (Saudi Arabia)
196 else if ( wsCountry == L"IQ" )
197 usSubLang = SUBLANG_ARABIC_IRAQ; // Arabic (Iraq)
198 else if ( wsCountry == L"EG" )
199 usSubLang = SUBLANG_ARABIC_EGYPT; // Arabic (Egypt)
200 else if ( wsCountry == L"LY" )
201 usSubLang = SUBLANG_ARABIC_LIBYA; // Arabic (Libya)
202 else if ( wsCountry == L"DZ" )
203 usSubLang = SUBLANG_ARABIC_ALGERIA; // Arabic (Algeria)
204 else if ( wsCountry == L"MA" )
205 usSubLang = SUBLANG_ARABIC_MOROCCO; // Arabic (Morocco)
206 else if ( wsCountry == L"TN" )
207 usSubLang = SUBLANG_ARABIC_TUNISIA; // Arabic (Tunisia)
208 else if ( wsCountry == L"OM" )
209 usSubLang = SUBLANG_ARABIC_OMAN; // Arabic (Oman)
210 else if ( wsCountry == L"YE" )
211 usSubLang = SUBLANG_ARABIC_YEMEN; // Arabic (Yemen)
212 else if ( wsCountry == L"SY" )
213 usSubLang = SUBLANG_ARABIC_SYRIA; // Arabic (Syria)
214 else if ( wsCountry == L"JO" )
215 usSubLang = SUBLANG_ARABIC_JORDAN; // Arabic (Jordan)
216 else if ( wsCountry == L"LB" )
217 usSubLang = SUBLANG_ARABIC_LEBANON; // Arabic (Lebanon)
218 else if ( wsCountry == L"KW" )
219 usSubLang = SUBLANG_ARABIC_KUWAIT; // Arabic (Kuwait)
220 else if ( wsCountry == L"AE" )
221 usSubLang = SUBLANG_ARABIC_UAE; // Arabic (U.A.E.)
222 else if ( wsCountry == L"BH" )
223 usSubLang = SUBLANG_ARABIC_BAHRAIN; // Arabic (Bahrain)
224 else if ( wsCountry == L"QA" )
225 usSubLang = SUBLANG_ARABIC_QATAR; // Arabic (Qatar)
226 else
227 usSubLang = SUBLANG_DEFAULT; //default sub language
229 else if ( wsLanguage == L"bg" )
230 usPrimaryLang = LANG_BULGARIAN; //Bulgarian 02
231 else if ( wsLanguage == L"ca" )
232 usPrimaryLang = LANG_CATALAN; //Catalan 03
233 else if ( wsLanguage == L"zh" )
235 usPrimaryLang = LANG_CHINESE; //Chinese
236 if ( wsCountry == L"TW" )
237 usSubLang = SUBLANG_CHINESE_TRADITIONAL; // Chinese (Traditional)
238 else if ( wsCountry == L"CN" )
239 usSubLang = SUBLANG_CHINESE_SIMPLIFIED; // Chinese (Simplified)
240 else if ( wsCountry == L"HK" )
241 usSubLang = SUBLANG_CHINESE_HONGKONG; // Chinese (Hong Kong SAR, PRC)
242 else if ( wsCountry == L"SG" )
243 usSubLang = SUBLANG_CHINESE_SINGAPORE; // Chinese (Singapore)
244 else if ( wsCountry == L"MO" )
245 usSubLang = SUBLANG_CHINESE_MACAU; // Chinese (Macau SAR)
246 else
247 usSubLang = SUBLANG_DEFAULT; //default sub language
249 else if ( wsLanguage == L"cs" )
250 usPrimaryLang = LANG_CZECH; //Czech
251 else if ( wsLanguage == L"da" )
252 usPrimaryLang = LANG_DANISH; //Danish
253 else if ( wsLanguage == L"de" )
255 usPrimaryLang = LANG_GERMAN; //German
256 if ( wsCountry == L"DE" )
257 usSubLang = SUBLANG_GERMAN; // German
258 else if ( wsCountry == L"CH" )
259 usSubLang = SUBLANG_GERMAN_SWISS; // German (Swiss)
260 else if ( wsCountry == L"AT" )
261 usSubLang = SUBLANG_GERMAN_AUSTRIAN; // German (Austrian)
262 else if ( wsCountry == L"LU" )
263 usSubLang = SUBLANG_GERMAN_LUXEMBOURG; // German (Luxembourg)
264 else if ( wsCountry == L"LI" )
265 usSubLang = SUBLANG_GERMAN_LIECHTENSTEIN; // German (Liechtenstein)
266 else
267 usSubLang = SUBLANG_DEFAULT; //default sub language
269 else if ( wsLanguage == L"el" )
270 usPrimaryLang = LANG_GREEK; //Greek
271 else if ( wsLanguage == L"en" )
273 usPrimaryLang = LANG_ENGLISH; //English
274 if ( wsCountry == L"US" )
275 usSubLang = SUBLANG_ENGLISH_US; // English (US)
276 else if ( wsCountry == L"GB" )
277 usSubLang = SUBLANG_ENGLISH_UK; // English (UK)
278 else if ( wsCountry == L"AU" )
279 usSubLang = SUBLANG_ENGLISH_AUS; // English (Australian)
280 else if ( wsCountry == L"CA" )
281 usSubLang = SUBLANG_ENGLISH_CAN; // English (Canadian)
282 else if ( wsCountry == L"NZ" )
283 usSubLang = SUBLANG_ENGLISH_NZ; // English (New Zealand)
284 else if ( wsCountry == L"IE" )
285 usSubLang = SUBLANG_ENGLISH_EIRE; // English (Ireland)
286 else if ( wsCountry == L"ZA" )
287 usSubLang = SUBLANG_ENGLISH_SOUTH_AFRICA; // English (South Africa)
288 else if ( wsCountry == L"JM" )
289 usSubLang = SUBLANG_ENGLISH_JAMAICA; // English (Jamaica)
290 else if ( wsCountry == L"GD" )
291 usSubLang = SUBLANG_ENGLISH_CARIBBEAN; // English (Caribbean) Grenada
292 else if ( wsCountry == L"BZ" )
293 usSubLang = SUBLANG_ENGLISH_BELIZE; // English (Belize)
294 else if ( wsCountry == L"TT" )
295 usSubLang = SUBLANG_ENGLISH_TRINIDAD; // English (Trinidad)
296 else if ( wsCountry == L"ZW" )
297 usSubLang = SUBLANG_ENGLISH_ZIMBABWE; // English (Zimbabwe)
298 else if ( wsCountry == L"PH" )
299 usSubLang = SUBLANG_ENGLISH_PHILIPPINES; // English (Philippines)
300 else
301 usSubLang = SUBLANG_DEFAULT; //default sub language
303 else if ( wsLanguage == L"es" )
305 usPrimaryLang = LANG_SPANISH; //Spanish
306 //else if ( wsCountry == L"ES" )
307 // usSubLang = SUBLANG_SPANISH; // Spanish (Castilian)
308 if ( wsCountry == L"MX" )
309 usSubLang = SUBLANG_SPANISH_MEXICAN; // Spanish (Mexican)
310 else if ( wsCountry == L"ES" )
311 usSubLang = SUBLANG_SPANISH_MODERN; // Spanish (Spain)
312 else if ( wsCountry == L"GT" )
313 usSubLang = SUBLANG_SPANISH_GUATEMALA; // Spanish (Guatemala)
314 else if ( wsCountry == L"CR" )
315 usSubLang = SUBLANG_SPANISH_COSTA_RICA; // Spanish (Costa Rica)
316 else if ( wsCountry == L"PA" )
317 usSubLang = SUBLANG_SPANISH_PANAMA; // Spanish (Panama)
318 else if ( wsCountry == L"DO" )
319 usSubLang = SUBLANG_SPANISH_DOMINICAN_REPUBLIC; // Spanish (Dominican Republic)
320 else if ( wsCountry == L"VE" )
321 usSubLang = SUBLANG_SPANISH_VENEZUELA; // Spanish (Venezuela)
322 else if ( wsCountry == L"CO" )
323 usSubLang = SUBLANG_SPANISH_COLOMBIA; // Spanish (Colombia)
324 else if ( wsCountry == L"PE" )
325 usSubLang = SUBLANG_SPANISH_PERU; // Spanish (Peru)
326 else if ( wsCountry == L"AR" )
327 usSubLang = SUBLANG_SPANISH_ARGENTINA; // Spanish (Argentina)
328 else if ( wsCountry == L"EC" )
329 usSubLang = SUBLANG_SPANISH_ECUADOR; // Spanish (Ecuador)
330 else if ( wsCountry == L"CL" )
331 usSubLang = SUBLANG_SPANISH_CHILE; // Spanish (Chile)
332 else if ( wsCountry == L"UY" )
333 usSubLang = SUBLANG_SPANISH_URUGUAY; // Spanish (Uruguay)
334 else if ( wsCountry == L"PY" )
335 usSubLang = SUBLANG_SPANISH_PARAGUAY; // Spanish (Paraguay)
336 else if ( wsCountry == L"BO" )
337 usSubLang = SUBLANG_SPANISH_BOLIVIA; // Spanish (Bolivia)
338 else if ( wsCountry == L"SV" )
339 usSubLang = SUBLANG_SPANISH_EL_SALVADOR; // Spanish (El Salvador)
340 else if ( wsCountry == L"HN" )
341 usSubLang = SUBLANG_SPANISH_HONDURAS; // Spanish (Honduras)
342 else if ( wsCountry == L"NI" )
343 usSubLang = SUBLANG_SPANISH_NICARAGUA; // Spanish (Nicaragua)
344 else if ( wsCountry == L"PR" )
345 usSubLang = SUBLANG_SPANISH_PUERTO_RICO; // Spanish (Puerto Rico)
346 else
347 usSubLang = SUBLANG_DEFAULT; //default sub language
349 else if ( wsLanguage == L"fi" )
350 usPrimaryLang = LANG_FINNISH; //Finnish
351 else if ( wsLanguage == L"fr" )
353 usPrimaryLang = LANG_FRENCH; //French
354 if ( wsCountry == L"FR" )
355 usSubLang = SUBLANG_FRENCH; // French
356 else if ( wsCountry == L"BE" )
357 usSubLang = SUBLANG_FRENCH_BELGIAN; // French (Belgian)
358 else if ( wsCountry == L"CA" )
359 usSubLang = SUBLANG_FRENCH_CANADIAN; // French (Canadian)
360 else if ( wsCountry == L"CH" )
361 usSubLang = SUBLANG_FRENCH_SWISS; // French (Swiss)
362 else if ( wsCountry == L"LU" )
363 usSubLang = SUBLANG_FRENCH_LUXEMBOURG; // French (Luxembourg)
364 else if ( wsCountry == L"MC" )
365 usSubLang = SUBLANG_FRENCH_MONACO; // French (Monaco)
366 else
367 usSubLang = SUBLANG_DEFAULT; //default sub language
369 else if ( wsLanguage == L"iw" )
370 usPrimaryLang = LANG_HEBREW; //Hebrew
371 else if ( wsLanguage == L"hu" )
372 usPrimaryLang = LANG_HUNGARIAN; //Hungarian
373 else if ( wsLanguage == L"is" )
374 usPrimaryLang = LANG_ICELANDIC; //Icelandic
375 else if ( wsLanguage == L"it" )
377 usPrimaryLang = LANG_ITALIAN; //Italian
378 if ( wsCountry == L"IT" )
379 usSubLang = SUBLANG_ITALIAN; // Italian
380 else if ( wsCountry == L"CH" )
381 usSubLang = SUBLANG_ITALIAN_SWISS; // Italian (Swiss)
382 else
383 usSubLang = SUBLANG_DEFAULT; //default sub language
385 else if ( wsLanguage == L"ja" )
386 usPrimaryLang = LANG_JAPANESE; //Japanese
387 else if ( wsLanguage == L"ko" )
389 usPrimaryLang = LANG_KOREAN; //Korean
390 if ( wsCountry == L"KR" )
391 usSubLang = SUBLANG_KOREAN; // Korean
392 else
393 usSubLang = SUBLANG_DEFAULT; //default sub language
395 else if ( wsLanguage == L"nl" )
397 usPrimaryLang = LANG_DUTCH; //Dutch
398 if ( wsCountry == L"NL" )
399 usSubLang = SUBLANG_DUTCH; // Dutch
400 else if ( wsCountry == L"BE" )
401 usSubLang = SUBLANG_DUTCH_BELGIAN; // Dutch (Belgian)
402 else
403 usSubLang = SUBLANG_DEFAULT; //default sub language
405 else if ( wsLanguage == L"no" )
407 usPrimaryLang = LANG_NORWEGIAN; //Norwegian
408 if ( wsCountry == L"NO" )
409 usSubLang = SUBLANG_NORWEGIAN_BOKMAL; // Norwegian (Bokmal)
410 //else if ( wsCountry == L"NO" )
411 // usSubLang = SUBLANG_NORWEGIAN_NYNORSK; // Norwegian (Nynorsk)
412 else
413 usSubLang = SUBLANG_DEFAULT; //default sub language
415 else if ( wsLanguage == L"pl" )
416 usPrimaryLang = LANG_POLISH; //Polish
417 else if ( wsLanguage == L"pt" )
419 usPrimaryLang = LANG_PORTUGUESE; //Portuguese
420 if ( wsCountry == L"BR" )
421 usSubLang = SUBLANG_PORTUGUESE_BRAZILIAN; // Portuguese (Brazil)
422 else if ( wsCountry == L"PT" )
423 usSubLang = SUBLANG_PORTUGUESE; // Portuguese (Portugal)
424 else
425 usSubLang = SUBLANG_DEFAULT; //default sub language
427 else if ( wsLanguage == L"ro" )
428 usPrimaryLang = LANG_ROMANIAN; //Romanian
429 else if ( wsLanguage == L"ru" )
430 usPrimaryLang = LANG_RUSSIAN; //Russian
431 else if ( wsLanguage == L"hr" )
432 usPrimaryLang = LANG_CROATIAN; //Croatian
433 else if ( wsLanguage == L"sr" )
435 usPrimaryLang = LANG_SERBIAN; //Serbian
436 if ( wsCountry == L"VA" )
437 usSubLang = SUBLANG_SERBIAN_LATIN; // Serbian (Latin)
438 else if ( wsCountry == L"HR" )
439 usSubLang = SUBLANG_SERBIAN_CYRILLIC; // Serbian (Cyrillic)
440 else
441 usSubLang = SUBLANG_DEFAULT; //default sub language
443 else if ( wsLanguage == L"sk" )
444 usPrimaryLang = LANG_SLOVAK; //Slovak
445 else if ( wsLanguage == L"sq" )
446 usPrimaryLang = LANG_ALBANIAN; //Albanian
447 else if ( wsLanguage == L"sv" )
449 usPrimaryLang = LANG_SWEDISH; //Swedish
450 if ( wsCountry == L"SE" )
451 usSubLang = SUBLANG_SWEDISH; // Swedish
452 else if ( wsCountry == L"FI" )
453 usSubLang = SUBLANG_SWEDISH_FINLAND; // Swedish (Finland)
454 else
455 usSubLang = SUBLANG_DEFAULT; //default sub language
457 else if ( wsLanguage == L"th" )
458 usPrimaryLang = LANG_THAI; //Thai
459 else if ( wsLanguage == L"tr" )
460 usPrimaryLang = LANG_TURKISH; //Turkish
461 else if ( wsLanguage == L"ur" )
463 usPrimaryLang = LANG_URDU; //Urdu
464 if ( wsCountry == L"PK" )
465 usSubLang = SUBLANG_URDU_PAKISTAN; // Urdu (Pakistan)
466 else if ( wsCountry == L"IN" )
467 usSubLang = SUBLANG_URDU_INDIA; // Urdu (India)
468 else
469 usSubLang = SUBLANG_DEFAULT; //default sub language
471 else if ( wsLanguage == L"in" )
472 usPrimaryLang = LANG_INDONESIAN; //Indonesian
473 else if ( wsLanguage == L"uk" )
474 usPrimaryLang = LANG_UKRAINIAN; //Ukrainian
475 else if ( wsLanguage == L"be" )
476 usPrimaryLang = LANG_BELARUSIAN; //Belarusian
477 else if ( wsLanguage == L"sl" )
478 usPrimaryLang = LANG_SLOVENIAN; //Slovenian
479 else if ( wsLanguage == L"et" )
480 usPrimaryLang = LANG_ESTONIAN; //Estonian
481 else if ( wsLanguage == L"lv" )
482 usPrimaryLang = LANG_LATVIAN; //Latvian
483 else if ( wsLanguage == L"lt" )
485 usPrimaryLang = LANG_LITHUANIAN; //Lithuanian
486 if ( wsCountry == L"LT" )
487 usSubLang = SUBLANG_LITHUANIAN; // Lithuanian
488 else
489 usSubLang = SUBLANG_DEFAULT; //default sub language
491 else if ( wsLanguage == L"fa" )
492 usPrimaryLang = LANG_FARSI; //Farsi
493 else if ( wsLanguage == L"vi" )
494 usPrimaryLang = LANG_VIETNAMESE; //Vietnamese
495 else if ( wsLanguage == L"hy" )
496 usPrimaryLang = LANG_ARMENIAN; //Armenian
497 else if ( wsLanguage == L"az" )
499 usPrimaryLang = LANG_AZERI; //Azeri
500 //if ( wsCountry == L" " )
501 // usSubLang = SUBLANG_AZERI_LATIN; // Azeri (Latin)
502 //else if ( wsCountry == L" " )
503 // usSubLang = SUBLANG_AZERI_CYRILLIC; // Azeri (Cyrillic)
505 else if ( wsLanguage == L"eu" )
506 usPrimaryLang = LANG_BASQUE; //Basque
507 else if ( wsLanguage == L"mk" )
508 usPrimaryLang = LANG_MACEDONIAN; //FYRO Macedonian
509 else if ( wsLanguage == L"af" )
510 usPrimaryLang = LANG_AFRIKAANS; //Afrikaans
511 else if ( wsLanguage == L"ka" )
512 usPrimaryLang = LANG_GEORGIAN; //Georgian
513 else if ( wsLanguage == L"fo" )
514 usPrimaryLang = LANG_FAEROESE; //Faeroese
515 else if ( wsLanguage == L"hi" )
516 usPrimaryLang = LANG_HINDI; //Hindi
517 else if ( wsLanguage == L"ms" )
519 usPrimaryLang = LANG_MALAY; //Malay
520 if ( wsCountry == L"MY" )
521 usSubLang = SUBLANG_MALAY_MALAYSIA; // Malay (Malaysia)
522 else if ( wsCountry == L"BN" )
523 usSubLang = SUBLANG_MALAY_BRUNEI_DARUSSALAM; // Malay (Brunei Darassalam)
524 else
525 usSubLang = SUBLANG_DEFAULT; //default sub language
527 else if ( wsLanguage == L"kk" )
528 usPrimaryLang = LANG_KAZAK; //Kazak
529 else if ( wsLanguage == L"ky" )
530 usPrimaryLang = LANG_KYRGYZ; //Kyrgyz
531 else if ( wsLanguage == L"sw" )
532 usPrimaryLang = LANG_SWAHILI; //Swahili
533 else if ( wsLanguage == L"uz" )
535 usPrimaryLang = LANG_UZBEK; //Uzbek
536 if ( wsCountry == L"UZ" )
537 usSubLang = SUBLANG_UZBEK_LATIN; // Uzbek (Latin)
538 else if ( wsCountry == L"DE" )
539 usSubLang = SUBLANG_UZBEK_CYRILLIC; // Uzbek (Cyrillic)
540 else
541 usSubLang = SUBLANG_DEFAULT; //default sub language
543 else if ( wsLanguage == L"tt" )
544 usPrimaryLang = LANG_TATAR; //Tatar
545 else if ( wsLanguage == L"bn" )
546 usPrimaryLang = LANG_BENGALI; //Not supported.
547 else if ( wsLanguage == L"pa" )
548 usPrimaryLang = LANG_PUNJABI; //Punjabi
549 else if ( wsLanguage == L"gu" )
550 usPrimaryLang = LANG_GUJARATI; //Gujarati
551 else if ( wsLanguage == L"or" )
552 usPrimaryLang = LANG_ORIYA; //Not supported.
553 else if ( wsLanguage == L"ta" )
554 usPrimaryLang = LANG_TAMIL; //Tamil
555 else if ( wsLanguage == L"te" )
556 usPrimaryLang = LANG_TELUGU; //Telugu
557 else if ( wsLanguage == L"kn" )
558 usPrimaryLang = LANG_KANNADA; //Kannada
559 else if ( wsLanguage == L"ml" )
560 usPrimaryLang = LANG_MALAYALAM; //Not supported.
561 else if ( wsLanguage == L"as" )
562 usPrimaryLang = LANG_ASSAMESE; //Not supported.
563 else if ( wsLanguage == L"mr" )
564 usPrimaryLang = LANG_MARATHI; //Marathi
565 else if ( wsLanguage == L"sa" )
566 usPrimaryLang = LANG_SANSKRIT; //Sanskrit
567 else if ( wsLanguage == L"mn" )
568 usPrimaryLang = LANG_MONGOLIAN; //Mongolian
569 else if ( wsLanguage == L"gl" )
570 usPrimaryLang = LANG_GALICIAN; //Galician
571 else if ( wsLanguage == L"sd" )
572 usPrimaryLang = LANG_SINDHI; //Not supported.
573 else if ( wsLanguage == L"ks" )
574 usPrimaryLang = LANG_KASHMIRI; //Not supported.
575 else if ( wsLanguage == L"ne" )
576 usPrimaryLang = LANG_NEPALI; //Not supported.
577 //else if ( wsLanguage == L" " )
578 // usPrimaryLang = LANG_MANIPURI; //Not supported.
579 //else if ( wsLanguage == L" " )
580 // usPrimaryLang = LANG_KONKANI; //Konkani
581 //else if ( wsLanguage == L" " )
582 // usPrimaryLang = LANG_SYRIAC; //Syriac
583 //else if ( wsLanguage == L" " )
584 // usPrimaryLang = LANG_DIVEHI; //Divehi
585 else
586 return GetSystemDefaultLCID(); //System Default Locale
588 return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT );