Bump version to 5.0-14
[LibreOffice.git] / shell / source / win32 / shlxthandler / util / utilities.cxx
blob8712aa252e10aff59c36d3581b45f9ac2370d7e6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #undef OSL_DEBUG_LEVEL
23 #include <osl/diagnose.h>
25 #include "internal/config.hxx"
26 #include "internal/utilities.hxx"
28 #ifdef _WIN32_WINNT_WINBLUE
29 #include <VersionHelpers.h>
30 #endif
32 // constants
35 const size_t MAX_RES_STRING = 1024;
36 const wchar_t SPACE_CHAR = _T(' ');
38 static std::wstring StringToWString(const std::string& String, int codepage)
40 int len = MultiByteToWideChar(
41 codepage, 0, String.c_str(), -1, 0, 0);
43 wchar_t* buff = reinterpret_cast<wchar_t*>(
44 _alloca(len * sizeof(wchar_t)));
46 MultiByteToWideChar(
47 codepage, 0, String.c_str(), -1, buff, len);
49 return std::wstring(buff);
52 static std::string WStringToString(const std::wstring& String, int codepage)
54 int len = WideCharToMultiByte(
55 codepage, 0, String.c_str(), -1, 0, 0, 0, 0);
57 char* buff = reinterpret_cast<char*>(
58 _alloca(len * sizeof(char)));
60 WideCharToMultiByte(
61 codepage, 0, String.c_str(), -1, buff, len, 0, 0);
63 return std::string(buff);
67 /**
69 std::wstring StringToWString(const std::string& String)
71 return StringToWString(String, CP_ACP);
75 /**
77 std::string WStringToString(const std::wstring& String)
79 return WStringToString(String, CP_ACP);
83 /**
85 std::wstring UTF8ToWString(const std::string& String)
87 return StringToWString(String, CP_UTF8);
91 /**
93 std::wstring GetResString(int ResId)
95 wchar_t szResStr[MAX_RES_STRING];
97 int rc = LoadStringW( GetModuleHandleW(MODULE_NAME), ResId, szResStr, sizeof(szResStr) );
99 OutputDebugStringFormat( "GetResString: read %d chars\n", rc );
100 OSL_ENSURE(rc, "String resource not found");
102 return std::wstring(szResStr);
108 bool is_windows_xp_or_above()
110 // the Win32 SDK 8.1 deprecates GetVersionEx()
111 #ifdef _WIN32_WINNT_WINBLUE
112 return IsWindowsXPOrGreater() ? true : false;
113 #else
114 OSVERSIONINFO osvi;
115 ZeroMemory(&osvi, sizeof(osvi));
116 osvi.dwOSVersionInfoSize = sizeof(osvi);
117 GetVersionEx(&osvi);
119 // LLA: check for windows xp or above (Vista)
120 if (osvi.dwMajorVersion > 5 ||
121 (5 == osvi.dwMajorVersion && osvi.dwMinorVersion >= 1))
123 return true;
125 return false;
126 #endif
130 /** helper function to judge if the string is only has spaces.
131 @returns
132 <TRUE>if the provided string contains only but at least one space
133 character else <FALSE/>.
136 bool HasOnlySpaces(const std::wstring& String)
138 if ( String.length() == 0 )
139 return false;
141 const wchar_t* p = String.c_str();
143 while (*p)
145 if (*p++ != SPACE_CHAR)
146 return false;
149 return true;
153 /** helper function to convert windows paths to short form.
154 @returns
155 shortend path.
158 std::wstring getShortPathName( const std::wstring& aLongName )
160 std::wstring shortName = aLongName;
161 long length = GetShortPathName( aLongName.c_str(), NULL, 0 );
163 if ( length != 0 )
165 TCHAR* buffer = new TCHAR[ length+1 ];
166 length = GetShortPathName( aLongName.c_str(), buffer, length );
167 if ( length != 0 )
168 shortName = std::wstring( buffer );
169 delete [] buffer;
171 return shortName;
175 /** convert LocaleSet pair into Microsoft List of Locale ID (LCID)
176 according to ISO-639 and ISO-3166.
177 http://etext.lib.virginia.edu/tei/iso639.html
178 http://nl.ijs.si/gnusl/cee/std/ISO_3166.html
179 @param
180 Locale, LocaleSet
181 @returns
182 Windows Locale Identifier corresponding to input LocaleSet.
183 @Usage Sample
184 LocaleSet_t myDefaultLocale( ::std::wstring( L"zh" ),::std::wstring(L"HK") );
185 DWORD myLCID = LocaleSetToLCID( myDefaultLocale );
186 wchar_t buffer[20];
187 _ultow( myLCID, buffer, 16 );
188 MessageBox( NULL, buffer,L"the LCID is:",MB_OK );
191 LCID LocaleSetToLCID( const LocaleSet_t & Locale )
193 if ( EMPTY_LOCALE == Locale )
194 return GetSystemDefaultLCID();
196 USHORT usPrimaryLang= LANG_NEUTRAL;
197 USHORT usSubLang=SUBLANG_DEFAULT;
199 ::std::wstring wsLanguage(Locale.first);
200 ::std::wstring wsCountry(Locale.second);
202 if ( wsLanguage == L"ar" )
204 usPrimaryLang = LANG_ARABIC; // Arabic 01
206 if ( wsCountry == L"SA" )
207 usSubLang = SUBLANG_ARABIC_SAUDI_ARABIA; // Arabic (Saudi Arabia)
208 else if ( wsCountry == L"IQ" )
209 usSubLang = SUBLANG_ARABIC_IRAQ; // Arabic (Iraq)
210 else if ( wsCountry == L"EG" )
211 usSubLang = SUBLANG_ARABIC_EGYPT; // Arabic (Egypt)
212 else if ( wsCountry == L"LY" )
213 usSubLang = SUBLANG_ARABIC_LIBYA; // Arabic (Libya)
214 else if ( wsCountry == L"DZ" )
215 usSubLang = SUBLANG_ARABIC_ALGERIA; // Arabic (Algeria)
216 else if ( wsCountry == L"MA" )
217 usSubLang = SUBLANG_ARABIC_MOROCCO; // Arabic (Morocco)
218 else if ( wsCountry == L"TN" )
219 usSubLang = SUBLANG_ARABIC_TUNISIA; // Arabic (Tunisia)
220 else if ( wsCountry == L"OM" )
221 usSubLang = SUBLANG_ARABIC_OMAN; // Arabic (Oman)
222 else if ( wsCountry == L"YE" )
223 usSubLang = SUBLANG_ARABIC_YEMEN; // Arabic (Yemen)
224 else if ( wsCountry == L"SY" )
225 usSubLang = SUBLANG_ARABIC_SYRIA; // Arabic (Syria)
226 else if ( wsCountry == L"JO" )
227 usSubLang = SUBLANG_ARABIC_JORDAN; // Arabic (Jordan)
228 else if ( wsCountry == L"LB" )
229 usSubLang = SUBLANG_ARABIC_LEBANON; // Arabic (Lebanon)
230 else if ( wsCountry == L"KW" )
231 usSubLang = SUBLANG_ARABIC_KUWAIT; // Arabic (Kuwait)
232 else if ( wsCountry == L"AE" )
233 usSubLang = SUBLANG_ARABIC_UAE; // Arabic (U.A.E.)
234 else if ( wsCountry == L"BH" )
235 usSubLang = SUBLANG_ARABIC_BAHRAIN; // Arabic (Bahrain)
236 else if ( wsCountry == L"QA" )
237 usSubLang = SUBLANG_ARABIC_QATAR; // Arabic (Qatar)
238 else
239 usSubLang = SUBLANG_DEFAULT; //default sub language
241 else if ( wsLanguage == L"bg" )
242 usPrimaryLang = LANG_BULGARIAN; //Bulgarian 02
243 else if ( wsLanguage == L"ca" )
244 usPrimaryLang = LANG_CATALAN; //Catalan 03
245 else if ( wsLanguage == L"zh" )
247 usPrimaryLang = LANG_CHINESE; //Chinese
248 if ( wsCountry == L"TW" )
249 usSubLang = SUBLANG_CHINESE_TRADITIONAL; // Chinese (Traditional)
250 else if ( wsCountry == L"CN" )
251 usSubLang = SUBLANG_CHINESE_SIMPLIFIED; // Chinese (Simplified)
252 else if ( wsCountry == L"HK" )
253 usSubLang = SUBLANG_CHINESE_HONGKONG; // Chinese (Hong Kong SAR, PRC)
254 else if ( wsCountry == L"SG" )
255 usSubLang = SUBLANG_CHINESE_SINGAPORE; // Chinese (Singapore)
256 else if ( wsCountry == L"MO" )
257 usSubLang = SUBLANG_CHINESE_MACAU; // Chinese (Macau SAR)
258 else
259 usSubLang = SUBLANG_DEFAULT; //default sub language
261 else if ( wsLanguage == L"cs" )
262 usPrimaryLang = LANG_CZECH; //Czech
263 else if ( wsLanguage == L"da" )
264 usPrimaryLang = LANG_DANISH; //Danish
265 else if ( wsLanguage == L"de" )
267 usPrimaryLang = LANG_GERMAN; //German
268 if ( wsCountry == L"DE" )
269 usSubLang = SUBLANG_GERMAN; // German
270 else if ( wsCountry == L"CH" )
271 usSubLang = SUBLANG_GERMAN_SWISS; // German (Swiss)
272 else if ( wsCountry == L"AT" )
273 usSubLang = SUBLANG_GERMAN_AUSTRIAN; // German (Austrian)
274 else if ( wsCountry == L"LU" )
275 usSubLang = SUBLANG_GERMAN_LUXEMBOURG; // German (Luxembourg)
276 else if ( wsCountry == L"LI" )
277 usSubLang = SUBLANG_GERMAN_LIECHTENSTEIN; // German (Liechtenstein)
278 else
279 usSubLang = SUBLANG_DEFAULT; //default sub language
281 else if ( wsLanguage == L"el" )
282 usPrimaryLang = LANG_GREEK; //Greek
283 else if ( wsLanguage == L"en" )
285 usPrimaryLang = LANG_ENGLISH; //English
286 if ( wsCountry == L"US" )
287 usSubLang = SUBLANG_ENGLISH_US; // English (US)
288 else if ( wsCountry == L"GB" )
289 usSubLang = SUBLANG_ENGLISH_UK; // English (UK)
290 else if ( wsCountry == L"AU" )
291 usSubLang = SUBLANG_ENGLISH_AUS; // English (Australian)
292 else if ( wsCountry == L"CA" )
293 usSubLang = SUBLANG_ENGLISH_CAN; // English (Canadian)
294 else if ( wsCountry == L"NZ" )
295 usSubLang = SUBLANG_ENGLISH_NZ; // English (New Zealand)
296 else if ( wsCountry == L"IE" )
297 usSubLang = SUBLANG_ENGLISH_EIRE; // English (Ireland)
298 else if ( wsCountry == L"ZA" )
299 usSubLang = SUBLANG_ENGLISH_SOUTH_AFRICA; // English (South Africa)
300 else if ( wsCountry == L"JM" )
301 usSubLang = SUBLANG_ENGLISH_JAMAICA; // English (Jamaica)
302 else if ( wsCountry == L"GD" )
303 usSubLang = SUBLANG_ENGLISH_CARIBBEAN; // English (Caribbean) Grenada
304 else if ( wsCountry == L"BZ" )
305 usSubLang = SUBLANG_ENGLISH_BELIZE; // English (Belize)
306 else if ( wsCountry == L"TT" )
307 usSubLang = SUBLANG_ENGLISH_TRINIDAD; // English (Trinidad)
308 else if ( wsCountry == L"ZW" )
309 usSubLang = SUBLANG_ENGLISH_ZIMBABWE; // English (Zimbabwe)
310 else if ( wsCountry == L"PH" )
311 usSubLang = SUBLANG_ENGLISH_PHILIPPINES; // English (Philippines)
312 else
313 usSubLang = SUBLANG_DEFAULT; //default sub language
315 else if ( wsLanguage == L"es" )
317 usPrimaryLang = LANG_SPANISH; //Spanish
318 if ( wsCountry == L"MX" )
319 usSubLang = SUBLANG_SPANISH_MEXICAN; // Spanish (Mexican)
320 else if ( wsCountry == L"ES" )
321 usSubLang = SUBLANG_SPANISH_MODERN; // Spanish (Spain)
322 else if ( wsCountry == L"GT" )
323 usSubLang = SUBLANG_SPANISH_GUATEMALA; // Spanish (Guatemala)
324 else if ( wsCountry == L"CR" )
325 usSubLang = SUBLANG_SPANISH_COSTA_RICA; // Spanish (Costa Rica)
326 else if ( wsCountry == L"PA" )
327 usSubLang = SUBLANG_SPANISH_PANAMA; // Spanish (Panama)
328 else if ( wsCountry == L"DO" )
329 usSubLang = SUBLANG_SPANISH_DOMINICAN_REPUBLIC; // Spanish (Dominican Republic)
330 else if ( wsCountry == L"VE" )
331 usSubLang = SUBLANG_SPANISH_VENEZUELA; // Spanish (Venezuela)
332 else if ( wsCountry == L"CO" )
333 usSubLang = SUBLANG_SPANISH_COLOMBIA; // Spanish (Colombia)
334 else if ( wsCountry == L"PE" )
335 usSubLang = SUBLANG_SPANISH_PERU; // Spanish (Peru)
336 else if ( wsCountry == L"AR" )
337 usSubLang = SUBLANG_SPANISH_ARGENTINA; // Spanish (Argentina)
338 else if ( wsCountry == L"EC" )
339 usSubLang = SUBLANG_SPANISH_ECUADOR; // Spanish (Ecuador)
340 else if ( wsCountry == L"CL" )
341 usSubLang = SUBLANG_SPANISH_CHILE; // Spanish (Chile)
342 else if ( wsCountry == L"UY" )
343 usSubLang = SUBLANG_SPANISH_URUGUAY; // Spanish (Uruguay)
344 else if ( wsCountry == L"PY" )
345 usSubLang = SUBLANG_SPANISH_PARAGUAY; // Spanish (Paraguay)
346 else if ( wsCountry == L"BO" )
347 usSubLang = SUBLANG_SPANISH_BOLIVIA; // Spanish (Bolivia)
348 else if ( wsCountry == L"SV" )
349 usSubLang = SUBLANG_SPANISH_EL_SALVADOR; // Spanish (El Salvador)
350 else if ( wsCountry == L"HN" )
351 usSubLang = SUBLANG_SPANISH_HONDURAS; // Spanish (Honduras)
352 else if ( wsCountry == L"NI" )
353 usSubLang = SUBLANG_SPANISH_NICARAGUA; // Spanish (Nicaragua)
354 else if ( wsCountry == L"PR" )
355 usSubLang = SUBLANG_SPANISH_PUERTO_RICO; // Spanish (Puerto Rico)
356 else
357 usSubLang = SUBLANG_DEFAULT; //default sub language
359 else if ( wsLanguage == L"fi" )
360 usPrimaryLang = LANG_FINNISH; //Finnish
361 else if ( wsLanguage == L"fr" )
363 usPrimaryLang = LANG_FRENCH; //French
364 if ( wsCountry == L"FR" )
365 usSubLang = SUBLANG_FRENCH; // French
366 else if ( wsCountry == L"BE" )
367 usSubLang = SUBLANG_FRENCH_BELGIAN; // French (Belgian)
368 else if ( wsCountry == L"CA" )
369 usSubLang = SUBLANG_FRENCH_CANADIAN; // French (Canadian)
370 else if ( wsCountry == L"CH" )
371 usSubLang = SUBLANG_FRENCH_SWISS; // French (Swiss)
372 else if ( wsCountry == L"LU" )
373 usSubLang = SUBLANG_FRENCH_LUXEMBOURG; // French (Luxembourg)
374 else if ( wsCountry == L"MC" )
375 usSubLang = SUBLANG_FRENCH_MONACO; // French (Monaco)
376 else
377 usSubLang = SUBLANG_DEFAULT; //default sub language
379 else if ( wsLanguage == L"iw" )
380 usPrimaryLang = LANG_HEBREW; //Hebrew
381 else if ( wsLanguage == L"hu" )
382 usPrimaryLang = LANG_HUNGARIAN; //Hungarian
383 else if ( wsLanguage == L"is" )
384 usPrimaryLang = LANG_ICELANDIC; //Icelandic
385 else if ( wsLanguage == L"it" )
387 usPrimaryLang = LANG_ITALIAN; //Italian
388 if ( wsCountry == L"IT" )
389 usSubLang = SUBLANG_ITALIAN; // Italian
390 else if ( wsCountry == L"CH" )
391 usSubLang = SUBLANG_ITALIAN_SWISS; // Italian (Swiss)
392 else
393 usSubLang = SUBLANG_DEFAULT; //default sub language
395 else if ( wsLanguage == L"ja" )
396 usPrimaryLang = LANG_JAPANESE; //Japanese
397 else if ( wsLanguage == L"ko" )
399 usPrimaryLang = LANG_KOREAN; //Korean
400 if ( wsCountry == L"KR" )
401 usSubLang = SUBLANG_KOREAN; // Korean
402 else
403 usSubLang = SUBLANG_DEFAULT; //default sub language
405 else if ( wsLanguage == L"nl" )
407 usPrimaryLang = LANG_DUTCH; //Dutch
408 if ( wsCountry == L"NL" )
409 usSubLang = SUBLANG_DUTCH; // Dutch
410 else if ( wsCountry == L"BE" )
411 usSubLang = SUBLANG_DUTCH_BELGIAN; // Dutch (Belgian)
412 else
413 usSubLang = SUBLANG_DEFAULT; //default sub language
415 else if ( wsLanguage == L"no" )
417 usPrimaryLang = LANG_NORWEGIAN; //Norwegian
418 if ( wsCountry == L"NO" )
419 usSubLang = SUBLANG_NORWEGIAN_BOKMAL; // Norwegian (Bokmal)
420 else
421 usSubLang = SUBLANG_DEFAULT; //default sub language
423 else if ( wsLanguage == L"pl" )
424 usPrimaryLang = LANG_POLISH; //Polish
425 else if ( wsLanguage == L"pt" )
427 usPrimaryLang = LANG_PORTUGUESE; //Portuguese
428 if ( wsCountry == L"BR" )
429 usSubLang = SUBLANG_PORTUGUESE_BRAZILIAN; // Portuguese (Brazil)
430 else if ( wsCountry == L"PT" )
431 usSubLang = SUBLANG_PORTUGUESE; // Portuguese (Portugal)
432 else
433 usSubLang = SUBLANG_DEFAULT; //default sub language
435 else if ( wsLanguage == L"ro" )
436 usPrimaryLang = LANG_ROMANIAN; //Romanian
437 else if ( wsLanguage == L"ru" )
438 usPrimaryLang = LANG_RUSSIAN; //Russian
439 else if ( wsLanguage == L"hr" )
440 usPrimaryLang = LANG_CROATIAN; //Croatian
441 else if ( wsLanguage == L"sr" )
443 usPrimaryLang = LANG_SERBIAN; //Serbian
444 if ( wsCountry == L"VA" )
445 usSubLang = SUBLANG_SERBIAN_LATIN; // Serbian (Latin)
446 else if ( wsCountry == L"HR" )
447 usSubLang = SUBLANG_SERBIAN_CYRILLIC; // Serbian (Cyrillic)
448 else
449 usSubLang = SUBLANG_DEFAULT; //default sub language
451 else if ( wsLanguage == L"sk" )
452 usPrimaryLang = LANG_SLOVAK; //Slovak
453 else if ( wsLanguage == L"sq" )
454 usPrimaryLang = LANG_ALBANIAN; //Albanian
455 else if ( wsLanguage == L"sv" )
457 usPrimaryLang = LANG_SWEDISH; //Swedish
458 if ( wsCountry == L"SE" )
459 usSubLang = SUBLANG_SWEDISH; // Swedish
460 else if ( wsCountry == L"FI" )
461 usSubLang = SUBLANG_SWEDISH_FINLAND; // Swedish (Finland)
462 else
463 usSubLang = SUBLANG_DEFAULT; //default sub language
465 else if ( wsLanguage == L"th" )
466 usPrimaryLang = LANG_THAI; //Thai
467 else if ( wsLanguage == L"tr" )
468 usPrimaryLang = LANG_TURKISH; //Turkish
469 else if ( wsLanguage == L"ur" )
471 usPrimaryLang = LANG_URDU; //Urdu
472 if ( wsCountry == L"PK" )
473 usSubLang = SUBLANG_URDU_PAKISTAN; // Urdu (Pakistan)
474 else if ( wsCountry == L"IN" )
475 usSubLang = SUBLANG_URDU_INDIA; // Urdu (India)
476 else
477 usSubLang = SUBLANG_DEFAULT; //default sub language
479 else if ( wsLanguage == L"in" )
480 usPrimaryLang = LANG_INDONESIAN; //Indonesian
481 else if ( wsLanguage == L"uk" )
482 usPrimaryLang = LANG_UKRAINIAN; //Ukrainian
483 else if ( wsLanguage == L"be" )
484 usPrimaryLang = LANG_BELARUSIAN; //Belarusian
485 else if ( wsLanguage == L"sl" )
486 usPrimaryLang = LANG_SLOVENIAN; //Slovenian
487 else if ( wsLanguage == L"et" )
488 usPrimaryLang = LANG_ESTONIAN; //Estonian
489 else if ( wsLanguage == L"lv" )
490 usPrimaryLang = LANG_LATVIAN; //Latvian
491 else if ( wsLanguage == L"lt" )
493 usPrimaryLang = LANG_LITHUANIAN; //Lithuanian
494 if ( wsCountry == L"LT" )
495 usSubLang = SUBLANG_LITHUANIAN; // Lithuanian
496 else
497 usSubLang = SUBLANG_DEFAULT; //default sub language
499 else if ( wsLanguage == L"fa" )
500 usPrimaryLang = LANG_FARSI; //Farsi
501 else if ( wsLanguage == L"vi" )
502 usPrimaryLang = LANG_VIETNAMESE; //Vietnamese
503 else if ( wsLanguage == L"hy" )
504 usPrimaryLang = LANG_ARMENIAN; //Armenian
505 else if ( wsLanguage == L"az" )
506 usPrimaryLang = LANG_AZERI; //Azeri
507 else if ( wsLanguage == L"eu" )
508 usPrimaryLang = LANG_BASQUE; //Basque
509 else if ( wsLanguage == L"mk" )
510 usPrimaryLang = LANG_MACEDONIAN; //FYRO Macedonian
511 else if ( wsLanguage == L"af" )
512 usPrimaryLang = LANG_AFRIKAANS; //Afrikaans
513 else if ( wsLanguage == L"ka" )
514 usPrimaryLang = LANG_GEORGIAN; //Georgian
515 else if ( wsLanguage == L"fo" )
516 usPrimaryLang = LANG_FAEROESE; //Faeroese
517 else if ( wsLanguage == L"hi" )
518 usPrimaryLang = LANG_HINDI; //Hindi
519 else if ( wsLanguage == L"ms" )
521 usPrimaryLang = LANG_MALAY; //Malay
522 if ( wsCountry == L"MY" )
523 usSubLang = SUBLANG_MALAY_MALAYSIA; // Malay (Malaysia)
524 else if ( wsCountry == L"BN" )
525 usSubLang = SUBLANG_MALAY_BRUNEI_DARUSSALAM; // Malay (Brunei Darassalam)
526 else
527 usSubLang = SUBLANG_DEFAULT; //default sub language
529 else if ( wsLanguage == L"kk" )
530 usPrimaryLang = LANG_KAZAK; //Kazakh
531 else if ( wsLanguage == L"ky" )
532 usPrimaryLang = LANG_KYRGYZ; //Kyrgyz
533 else if ( wsLanguage == L"sw" )
534 usPrimaryLang = LANG_SWAHILI; //Swahili
535 else if ( wsLanguage == L"uz" )
537 usPrimaryLang = LANG_UZBEK; //Uzbek
538 if ( wsCountry == L"UZ" )
539 usSubLang = SUBLANG_UZBEK_LATIN; // Uzbek (Latin)
540 else if ( wsCountry == L"DE" )
541 usSubLang = SUBLANG_UZBEK_CYRILLIC; // Uzbek (Cyrillic)
542 else
543 usSubLang = SUBLANG_DEFAULT; //default sub language
545 else if ( wsLanguage == L"tt" )
546 usPrimaryLang = LANG_TATAR; //Tatar
547 else if ( wsLanguage == L"bn" )
548 usPrimaryLang = LANG_BENGALI; //Not supported.
549 else if ( wsLanguage == L"pa" )
550 usPrimaryLang = LANG_PUNJABI; //Punjabi
551 else if ( wsLanguage == L"gu" )
552 usPrimaryLang = LANG_GUJARATI; //Gujarati
553 else if ( wsLanguage == L"or" )
554 usPrimaryLang = LANG_ORIYA; //Not supported.
555 else if ( wsLanguage == L"ta" )
556 usPrimaryLang = LANG_TAMIL; //Tamil
557 else if ( wsLanguage == L"te" )
558 usPrimaryLang = LANG_TELUGU; //Telugu
559 else if ( wsLanguage == L"kn" )
560 usPrimaryLang = LANG_KANNADA; //Kannada
561 else if ( wsLanguage == L"ml" )
562 usPrimaryLang = LANG_MALAYALAM; //Not supported.
563 else if ( wsLanguage == L"as" )
564 usPrimaryLang = LANG_ASSAMESE; //Not supported.
565 else if ( wsLanguage == L"mr" )
566 usPrimaryLang = LANG_MARATHI; //Marathi
567 else if ( wsLanguage == L"sa" )
568 usPrimaryLang = LANG_SANSKRIT; //Sanskrit
569 else if ( wsLanguage == L"mn" )
570 usPrimaryLang = LANG_MONGOLIAN; //Mongolian
571 else if ( wsLanguage == L"gl" )
572 usPrimaryLang = LANG_GALICIAN; //Galician
573 else if ( wsLanguage == L"sd" )
574 usPrimaryLang = LANG_SINDHI; //Not supported.
575 else if ( wsLanguage == L"ks" )
576 usPrimaryLang = LANG_KASHMIRI; //Not supported.
577 else if ( wsLanguage == L"ne" )
578 usPrimaryLang = LANG_NEPALI; //Not supported.
579 else
580 return GetSystemDefaultLCID(); //System Default Locale
582 return MAKELCID( MAKELANGID( usPrimaryLang, usSubLang ), SORT_DEFAULT );
585 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */