Source code of Windows XP (NT5)
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.

95 lines
1.9 KiB

  1. //+--------------------------------------------------------------------
  2. //
  3. // Author: AdamEd
  4. // Date: October 1998
  5. //
  6. // Implementation of language support
  7. // in the Class Store interface module
  8. //
  9. //
  10. //---------------------------------------------------------------------
  11. #include "cstore.hxx"
  12. LANGID gSystemLangId;
  13. //+--------------------------------------------------------------------
  14. //
  15. // InitializeLanguageSupport
  16. //
  17. // Routine Description:
  18. //
  19. // Called at dll init to initialize globals necessary for
  20. // language support
  21. //
  22. // Arguments:
  23. //
  24. // None.
  25. //
  26. // Return Value:
  27. //
  28. // none
  29. //---------------------------------------------------------------------
  30. void InitializeLanguageSupport()
  31. {
  32. gSystemLangId = GetSystemDefaultLangID();
  33. }
  34. DWORD GetLanguagePriority(LANGID PackageLangId, DWORD dwActFlags)
  35. {
  36. //
  37. // If the activation flags indicate that we should always
  38. // match regardless of language, this package gets the highest
  39. // precedence
  40. //
  41. if (dwActFlags & ACTFLG_IgnoreLanguage) {
  42. return PRI_LANG_ALWAYSMATCH;
  43. }
  44. //
  45. // The ignore language flag was not specified by the admin,
  46. // so now we must examine the language id of the package to
  47. // determine its desirability.
  48. //
  49. //
  50. // First, match against the system locale's language --
  51. // exact matches get highest priority
  52. //
  53. if (gSystemLangId == PackageLangId)
  54. {
  55. return PRI_LANG_SYSTEMLOCALE;
  56. }
  57. //
  58. // Try English -- English should function on all systems
  59. //
  60. if (LANG_ENGLISH == PRIMARYLANGID(PackageLangId))
  61. {
  62. return PRI_LANG_ENGLISH;
  63. }
  64. //
  65. // If we couldn't get better matches, accept language neutral
  66. // packages as a last resort
  67. //
  68. if (LANG_NEUTRAL == PackageLangId) {
  69. return PRI_LANG_NEUTRAL;
  70. }
  71. //
  72. // We couldn't find a match -- return the smallest priority
  73. //
  74. return 0;
  75. }