vue项目国际化很是的繁琐:html
template
中标签的label
或者其余property
中,或者{{}}
中script
,又或者script
中的,手动将一层一层的国际化key拷贝,粘贴。汉字检索原则git
<template></template>
中的>
与<
之间的汉字,如<span>汉字123</span>
<template></template>
中的标签属性的汉字,如<span title="汉字"></span>
<template></template>
中的{{
与}}
之间的汉字,如<span>{{test ? "汉字" : "中文" }}</span>
<script></script>
中的"
与"
之间的汉字,'
与'
之间的汉字生成更新Json路径配置,见路径及JSONgithub
生成更新原则web
替换原则json
汉字123
替换为 {{$t('unique-key')}}
title="汉字"
替换为 :title="$t('unique-key')"
汉字
替换为 $t('unique-key')
汉字
替换为 this.$t('unique-key')
相关正则,见传送门swift
替换依据Json,见路径及JSONapi
提示原则webstorm
/(?<=\$t\(["'])[^'"]+/gm
匹配已替换的字符串提示依据Json,见路径及JSONide
**.**
链接根目录:认定当前项目package.json
为根目录
当前文件:执行Json生成等命令所在的文件
[根目录]/src/locales/zh-cn.json
为默认json路径Default Locales Path
,如"test",则对应的json路径:[根目录]/``test/zh-cn.json
Parent Dir Level
,如3
则表明属性名头部添加取3层父文件夹名Module Prefix Fo Update JSON
,如 “sdm-ui”,会把“sdm-ui"添加到父文件夹名以前Not Alert Before Update I18n
,默认提示,若为true则会直接更新json不弹窗提醒Do Not Disturb
,默认false,若为true则会关闭任何命令提醒I18n Value Hover
,默认true,开启悬浮提示框功能tt
替换为{{$t('剪切板内容')}}
t
替换为$t('剪切板内容')
,需手动加:
t
替换为 $t('剪切板内容')
ttt
替换为 this.$t('剪切板内容')
内容 | 文档及帮助 |
---|---|
插件hello-world | [传送门] |
插件发布流程(官方) | [传送门] |
vscode插件官方实例 | [传送门] |
如何检测vue文件 | [传送门] |
vscode API | [传送门] |
vscode开发(中文) | [传送门] |
webstorm配置ide的live template | [传送门] |
[\u4e00-\u9fa5]
查找汉字