index.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * @Author: vera_min vera_min@163.com
  3. * @Date: 2025-08-02 12:21:54
  4. * @LastEditors: vera_min vera_min@163.com
  5. * @LastEditTime: 2025-08-06 01:54:53
  6. * @FilePath: /sagoo-admin-ui/src/i18n/index.ts
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { createI18n } from 'vue-i18n';
  10. import zhcnLocale from 'element-plus/lib/locale/lang/zh-cn';
  11. import enLocale from 'element-plus/lib/locale/lang/en';
  12. import zhtwLocale from 'element-plus/lib/locale/lang/zh-tw';
  13. import { store } from '/@/store/index';
  14. import nextZhcn from '/@/i18n/lang/zh-cn';
  15. import nextEn from '/@/i18n/lang/en';
  16. import nextZhtw from '/@/i18n/lang/zh-tw';
  17. import pagesLoginZhcn from '/@/i18n/pages/login/zh-cn';
  18. import pagesLoginEn from '/@/i18n/pages/login/en';
  19. import pagesLoginZhtw from '/@/i18n/pages/login/zh-tw';
  20. import pagesFormI18nZhcn from '/@/i18n/pages/formI18n/zh-cn';
  21. import pagesFormI18nEn from '/@/i18n/pages/formI18n/en';
  22. import pagesFormI18nZhtw from '/@/i18n/pages/formI18n/zh-tw';
  23. import pagesTable18nZhcn from './pages/tableI18n/zh-cn';
  24. import pagesTable18nEn from './pages/tableI18n/en';
  25. import pagesTable18nZhtw from './pages/tableI18n/zh-tw';
  26. import pagesIotmanagerZhcn from './pages/iotmanagerI18n/zh-cn';
  27. import pagesIotmanagerEn from './pages/iotmanagerI18n/en';
  28. import pagesIotmanagerZhtw from './pages/iotmanagerI18n/zh-tw';
  29. import pagesIotcardZhcn from './pages/iotCard/zh-cn';
  30. import pagesIotcardEn from './pages/iotCard/en';
  31. import pagesIotcardZhtw from './pages/iotCard/zh-tw';
  32. import pagesProjectsZhcn from './pages/projects/zh-cn';
  33. import pagesProjectsEn from './pages/projects/en';
  34. import pagesProjectsZhtw from './pages/projects/zh-tw';
  35. import pagesPropertyZhcn from './pages/property/zh-cn';
  36. import pagesPropertyEn from './pages/property/en';
  37. import pagesPropertyZhtw from './pages/property/zh-tw';
  38. import pagesDateCenterZhcn from './pages/dateCenter/zh-cn';
  39. import pagesDateCenterEn from './pages/dateCenter/en';
  40. import pagesDateCenterZhtw from './pages/dateCenter/zh-tw';
  41. // 定义语言国际化内容
  42. /**
  43. * 说明:
  44. * /src/i18n/lang 下的 ts 为框架的国际化内容
  45. * /src/i18n/pages 下的 ts 为各界面的国际化内容
  46. */
  47. const messages = {
  48. [zhcnLocale.name]: {
  49. ...zhcnLocale,
  50. message: {
  51. ...nextZhcn,
  52. ...pagesLoginZhcn,
  53. ...pagesFormI18nZhcn,
  54. ...pagesTable18nZhcn,
  55. ...pagesIotmanagerZhcn,
  56. iotCard: pagesIotcardZhcn,
  57. projects: pagesProjectsZhcn,
  58. property: pagesPropertyZhcn,
  59. dateCenter: pagesDateCenterZhcn
  60. }
  61. },
  62. [enLocale.name]: {
  63. ...enLocale,
  64. message: {
  65. ...nextEn,
  66. ...pagesLoginEn,
  67. ...pagesFormI18nEn,
  68. ...pagesTable18nEn,
  69. ...pagesIotmanagerEn,
  70. iotCard: pagesIotcardEn,
  71. projects: pagesProjectsEn,
  72. property: pagesPropertyEn,
  73. dateCenter: pagesDateCenterEn
  74. },
  75. },
  76. [zhtwLocale.name]: {
  77. ...zhtwLocale,
  78. message: {
  79. ...nextZhtw,
  80. ...pagesLoginZhtw,
  81. ...pagesFormI18nZhtw,
  82. ...pagesTable18nZhtw,
  83. ...pagesIotmanagerZhtw,
  84. iotCard: pagesIotcardZhtw,
  85. projects: pagesProjectsZhtw,
  86. property: pagesPropertyZhtw,
  87. dateCenter: pagesDateCenterZhtw
  88. },
  89. },
  90. };
  91. // 导出语言国际化
  92. export const i18n = createI18n({
  93. locale: store.state.themeConfig.themeConfig.globalI18n,
  94. fallbackLocale: zhcnLocale.name,
  95. messages,
  96. silentTranslationWarn: true,
  97. missingWarn: false,
  98. silentFallbackWarn: true,
  99. fallbackWarn: false
  100. });