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.

110 lines
2.2 KiB

  1. #include "base.h"
  2. #include "langsupport.h"
  3. #define LANG_ENG_US 0
  4. #define LANG_ENG_UK 1
  5. #define LANG_FRN 2
  6. #define LANG_SPN 3
  7. #define LANG_ITL 4
  8. #define NUM_OF_LANG 5
  9. LangInfo g_rLangDefaultValues[NUM_OF_LANG] =
  10. {
  11. {L',', L'.', L':', false}, // US
  12. {L',', L'.', L':', true}, // UK
  13. {(WCHAR)0xA0, L',', L':', true}, // FRN
  14. {L'.', L',', L':', true}, // SPN
  15. {L'.', L',', L'.', true}, // ITL
  16. };
  17. CLangSupport::CLangSupport(LCID lcid)
  18. {
  19. int i;
  20. WCHAR pwcs[4];
  21. CSpecialAbbreviationSet* pAbbSet;
  22. ULONG ulLang;
  23. switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
  24. {
  25. case LANG_ENGLISH:
  26. if (lcid == MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT))
  27. {
  28. ulLang = LANG_ENG_US;
  29. }
  30. else
  31. {
  32. ulLang = LANG_ENG_UK;
  33. }
  34. pAbbSet = g_pEngAbbList.Get();
  35. break;
  36. case LANG_FRENCH:
  37. ulLang = LANG_FRN;
  38. pAbbSet = g_pFrnAbbList.Get();
  39. break;
  40. case LANG_SPANISH:
  41. ulLang = LANG_SPN;
  42. pAbbSet = g_pSpnAbbList.Get();
  43. break;
  44. case LANG_ITALIAN:
  45. ulLang = LANG_ITL;
  46. pAbbSet = g_pItlAbbList.Get();
  47. break;
  48. default:
  49. Assert(0);
  50. }
  51. *((LangInfo*)this) = g_rLangDefaultValues[ulLang];
  52. m_pAbbSet = pAbbSet;
  53. i = GetLocaleInfo(
  54. lcid,
  55. LOCALE_SDECIMAL | LOCALE_NOUSEROVERRIDE ,
  56. pwcs,
  57. 4);
  58. if (i > 0)
  59. {
  60. m_wchSDecimal = pwcs[0];
  61. }
  62. i = GetLocaleInfo(
  63. lcid,
  64. LOCALE_STHOUSAND | LOCALE_NOUSEROVERRIDE ,
  65. pwcs,
  66. 4);
  67. if (i > 0)
  68. {
  69. m_wchSThousand = pwcs[0];
  70. }
  71. DWORD dwVal;
  72. i = GetLocaleInfo(
  73. lcid,
  74. LOCALE_IDATE | LOCALE_NOUSEROVERRIDE | LOCALE_RETURN_NUMBER,
  75. (WCHAR*)&dwVal,
  76. 2);
  77. if (i > 0)
  78. {
  79. if ((dwVal == 1) || (dwVal == 2))
  80. {
  81. m_bDayMonthOrder = true;
  82. }
  83. else
  84. {
  85. m_bDayMonthOrder = false;
  86. }
  87. }
  88. i = GetLocaleInfo(
  89. lcid,
  90. LOCALE_STIME | LOCALE_NOUSEROVERRIDE ,
  91. pwcs,
  92. 4);
  93. if (i > 0)
  94. {
  95. m_wchSTime = pwcs[0];
  96. }
  97. }