基于umi的开发模板

intl_helper.ts 372B

123456789101112131415161718
  1. import zh_CN from '@/locales/zh-CN';
  2. import en_US from '@/locales/en-US';
  3. import { lnk_lang } from './cookie_helper';
  4. export const intl_get = ({ id }: { id: string }): any => {
  5. if (lnk_lang) {
  6. switch (lnk_lang) {
  7. case "en-US":
  8. return en_US[id];
  9. case "zh-CN":
  10. default:
  11. return zh_CN[id];
  12. }
  13. } else {
  14. return zh_CN[id];
  15. }
  16. }