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]
查找漢字