Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.6 KiB

  1. /*************************************************************/
  2. /* Name: MSLCID.h
  3. /* Description:
  4. /*************************************************************/
  5. #ifndef MSLCID_H_INCLUDE
  6. #define MSLCID_H_INCLUDE
  7. class MSLangID
  8. {
  9. public:
  10. struct LanguageList
  11. {
  12. UINT ResourceID;
  13. WORD LangID;
  14. };
  15. int m_LLlength;
  16. LanguageList* m_LL;
  17. virtual ~MSLangID() {};
  18. MSLangID() {
  19. static LanguageList LL[] = {
  20. { IDS_DVD_LANG1, LANG_AFRIKAANS },
  21. { IDS_DVD_LANG2, LANG_ALBANIAN },
  22. { IDS_DVD_LANG3, LANG_ARABIC },
  23. { IDS_DVD_LANG4, LANG_BASQUE },
  24. { IDS_DVD_LANG5, LANG_BELARUSIAN },
  25. { IDS_DVD_LANG6, LANG_BULGARIAN },
  26. { IDS_DVD_LANG7, LANG_CATALAN },
  27. { IDS_DVD_LANG8, LANG_CHINESE },
  28. { IDS_DVD_LANG9, LANG_CROATIAN },
  29. { IDS_DVD_LANG10, LANG_CZECH },
  30. { IDS_DVD_LANG11, LANG_DANISH },
  31. { IDS_DVD_LANG12, LANG_DUTCH },
  32. { IDS_DVD_LANG13, LANG_ENGLISH },
  33. { IDS_DVD_LANG14, LANG_ESTONIAN },
  34. { IDS_DVD_LANG15, LANG_FAEROESE },
  35. { IDS_DVD_LANG16, LANG_FARSI },
  36. { IDS_DVD_LANG17, LANG_FINNISH },
  37. { IDS_DVD_LANG18, LANG_FRENCH },
  38. { IDS_DVD_LANG19, LANG_GERMAN },
  39. { IDS_DVD_LANG20, LANG_GREEK },
  40. { IDS_DVD_LANG21, LANG_HEBREW },
  41. { IDS_DVD_LANG22, LANG_HUNGARIAN },
  42. { IDS_DVD_LANG23, LANG_ICELANDIC },
  43. { IDS_DVD_LANG24, LANG_INDONESIAN },
  44. { IDS_DVD_LANG25, LANG_ITALIAN },
  45. { IDS_DVD_LANG26, LANG_JAPANESE },
  46. { IDS_DVD_LANG27, LANG_KOREAN },
  47. { IDS_DVD_LANG28, LANG_LATVIAN },
  48. { IDS_DVD_LANG29, LANG_LITHUANIAN },
  49. { IDS_DVD_LANG30, LANG_MALAY },
  50. { IDS_DVD_LANG31, LANG_NORWEGIAN },
  51. { IDS_DVD_LANG32, LANG_POLISH },
  52. { IDS_DVD_LANG33, LANG_PORTUGUESE },
  53. { IDS_DVD_LANG34, LANG_ROMANIAN },
  54. { IDS_DVD_LANG35, LANG_RUSSIAN },
  55. { IDS_DVD_LANG36, LANG_SERBIAN },
  56. { IDS_DVD_LANG37, LANG_SLOVAK },
  57. { IDS_DVD_LANG38, LANG_SLOVENIAN },
  58. { IDS_DVD_LANG39, LANG_SPANISH },
  59. { IDS_DVD_LANG40, LANG_SWAHILI },
  60. { IDS_DVD_LANG41, LANG_SWEDISH },
  61. { IDS_DVD_LANG42, LANG_THAI },
  62. { IDS_DVD_LANG43, LANG_TURKISH },
  63. { IDS_DVD_LANG44, LANG_UKRAINIAN },
  64. };
  65. m_LL = LL;
  66. m_LLlength = sizeof(LL)/sizeof(LL[0]);
  67. }/* of Contructor */
  68. static LPTSTR LoadStringFromRes(DWORD redId){
  69. TCHAR *string = new TCHAR[MAX_PATH];
  70. ::ZeroMemory(string, sizeof(TCHAR) * MAX_PATH);
  71. if (::LoadString(_Module.GetModuleInstance(), redId, string, MAX_PATH))
  72. return string;
  73. delete[] string;
  74. return NULL;
  75. }/* end of function LoadStringFromRes */
  76. LPTSTR GetLanguageFromLCID(LCID lcid){
  77. // Try to get it from the system first
  78. TCHAR *szLanguage = new TCHAR[MAX_PATH];
  79. int iRet = ::GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, szLanguage, MAX_PATH);
  80. if (iRet) {
  81. return szLanguage;
  82. }
  83. delete[] szLanguage;
  84. // Else try to find it in the private LCID table
  85. for(int i = 0; i < m_LLlength; i++) {
  86. if(m_LL[i].LangID == PRIMARYLANGID(LANGIDFROMLCID(lcid)))
  87. return LoadStringFromRes(m_LL[i].ResourceID);
  88. }
  89. return NULL;
  90. }/* end of function GetLanguageFromLCID */
  91. };
  92. #endif