langMap.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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": 'ProductCenter',
  74. },
  75. {
  76. keys: ["了解更多"],
  77. "en-us": 'More',
  78. },
  79. {
  80. keys: ["持续创新的软硬件产品","持续创新"],
  81. "en-us": 'Sustainable Innovation',
  82. },
  83. {
  84. keys: ["输入产品名称","请输入"],
  85. "en-us": 'input key for search',
  86. },
  87. {
  88. keys: ["产品类别"],
  89. "en-us": 'Product Type',
  90. },
  91. {
  92. keys: ["解决方案"],
  93. "en-us": 'Solution',
  94. },
  95. {
  96. keys: ["新闻中心"],
  97. "en-us": 'News',
  98. },
  99. {
  100. keys: ["联系购买"],
  101. "en-us": 'Contact purchase',
  102. },
  103. {
  104. keys: ["介绍"],
  105. "en-us": 'Introduction'
  106. },
  107. {
  108. keys: ["参数"],
  109. "en-us": 'Parameters'
  110. },
  111. ]
  112. const i18Paths =
  113. [
  114. {
  115. keys: ['/','/index'],
  116. "en-us": '/index_en',
  117. }
  118. ]
  119. function getText(langType,langKey){
  120. let item = textArr.find(val=>val.keys.includes(langKey));
  121. if(item && item[langType]){
  122. return item[langType]
  123. }else{
  124. return langKey
  125. }
  126. }
  127. function getAbbrText(langType,langKey){
  128. let item = textArr.find(val=>val.keys.includes(langKey));
  129. let AbbrTypeKey = "abbr-"+langType
  130. if(item){
  131. if(item[AbbrTypeKey]){
  132. return item[AbbrTypeKey]
  133. }else if(item && item[langType]){
  134. return item[langType]
  135. }
  136. }
  137. return langKey
  138. }
  139. function getLangPathStr(langType,langKey){
  140. let item = i18Paths.find(val=>val.keys.includes(langKey));
  141. if(item && item[langType]){
  142. return item[langType]
  143. }else{
  144. return langKey
  145. }
  146. }
  147. export default {
  148. lang,
  149. getText,
  150. getAbbrText,
  151. getLangPathStr
  152. }