Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>i18nleeNew to Visual Studio Code? Get it now.
i18nlee

i18nlee

0BE1B783-25B5BEB9

|
1 install
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

效果演示

效果图

使用方法

1.项目根目录新建 配置文件 i18n.config.js

module.exports = {
  i18nFile: "i18n.json", //语言配置文件
  checkDir: "./src",
  regexStr: "[\u4e00-\u9fa5]+(\\d+)*[\u4e00-\u9fa5]*[,,]*[\u4e00-\u9fa5]*[??.。]?", //关键词匹配
  fileTypes: ["javascript", "typescript", "vue", "html"], //支持哪些文件
  replaced(text, docType) {
    //检测是否已被替换过
    return /\$t\(['"]/.test(text) || /\{\{\s*\$t\(['"]/.test(text);
  },
  methods: [
    {
      title: "R属性", //替换名称
      replace(text, quote) {
        //text关键词 quote引号
        return `${quote}\$t('${text}')${quote}`; //替换内容
      },
    },
    {
      title: "JS",
      replace(text, quote) {
        return `this.\$t('${text}')`;
      },
    },
  ],
};

2.项目根目录新建 语言配置 i18n.json

{
  "上传中": "被替换的",//k:v  查找k替换为v
  "加载中": "",
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft