langMap.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const lang = {
  2. cn:'zh-cn',
  3. en:'en-us',
  4. }
  5. const textArr = [
  6. {
  7. keys: ["首页"],
  8. "en-us": 'index'
  9. },
  10. {
  11. keys: ["English"],
  12. "en-us": '中文'
  13. },
  14. {
  15. keys: ["合方圆管理平台","管理平台"],
  16. "en-us": 'HFY management platform',
  17. "abbr-en-us": 'HFY DMP'
  18. },
  19. {
  20. keys: ["智慧能源"],
  21. "en-us": 'Smart Energy (SE)',
  22. "abbr-en-us": 'S Energy'
  23. },
  24. {
  25. keys: ["输电线路摄像头"],
  26. "en-us": 'Power Transmission Line Camera',
  27. "abbr-en-us": 'TCLC ',
  28. },
  29. {
  30. keys: ["4G低功耗摄像头"],
  31. "en-us": '4G Low Power Camera',
  32. "abbr-en-us": '4G-LP Camera'
  33. },
  34. {
  35. keys: ["自动变焦双目协同摄像头"],
  36. "en-us": 'Auto-focus Dual-lens Coordinated Camera',
  37. "abbr-en-us": 'AF dual-camera'
  38. },
  39. {
  40. keys: ["M2M产品"],
  41. "en-us": 'M2M Products',
  42. },
  43. {
  44. keys: ["智能终端"],
  45. "en-us": 'Intelligent Terminal',
  46. },
  47. {
  48. keys: ["关于我们"],
  49. "en-us": 'about us',
  50. },
  51. {
  52. keys: ["智能产品"],
  53. "en-us": 'smart product',
  54. },
  55. {
  56. keys: ["服务与支持"],
  57. "en-us": 'server & support',
  58. },
  59. {
  60. keys: ["快速链接"],
  61. "en-us": 'quick link',
  62. },
  63. {
  64. keys: ["选择语言"],
  65. "en-us": 'Languages',
  66. },
  67. {
  68. keys: ["联系我们"],
  69. "en-us": 'contact us',
  70. },
  71. {
  72. keys: ["产品中心"],
  73. "en-us": 'product center',
  74. },
  75. {
  76. keys: ["了解更多"],
  77. "en-us": 'more',
  78. },
  79. ]
  80. function getText(langType,langKey){
  81. let item = textArr.find(val=>val.keys.includes(langKey));
  82. if(item && item[langType]){
  83. return item[langType]
  84. }else{
  85. return langKey
  86. }
  87. }
  88. function getAbbrText(langType,langKey){
  89. let item = textArr.find(val=>val.keys.includes(langKey));
  90. let AbbrTypeKey = "abbr-"+langType
  91. if(item){
  92. if(item[AbbrTypeKey]){
  93. return item[AbbrTypeKey]
  94. }else if(item && item[langType]){
  95. return item[langType]
  96. }
  97. }
  98. return langKey
  99. }
  100. export default {
  101. lang,
  102. getText,
  103. getAbbrText
  104. }