Extract characters, translate and generate i18n file
shift + command/ctrl + p
to search command
content
is selection content
Replace only the selected string (automatically includes the immediate quotation marks)
- <div>
Dashboard Title
</div>- <div>
t("extract-i18n.dashboardTitle")
</div>
- <div>
- <div>
"Dashboard Title"
</div>- <div>
t("extract-i18n.dashboardTitle")
</div>
- <div>
- <div>
'Dashboard Title'
</div>- <div>
t("extract-i18n.dashboardTitle)
</div>
- <div>
Replace the selected string (automatically includes the immediate quotation marks) and auto wrapper the {}
- <div>
Dashboard Title
</div>- <div>
{t("extract-i18n.dashboardTitle")}
</div>
- <div>
- <div>{
"Dashboard Title"
}</div>- <div>{
t("extract-i18n.dashboardTitle")
}</div>
- <div>{
- <div>
"Dashboard Title"
</div>- <div>
{t("extract-i18n.dashboardTitle")}
</div>
- <div>
- <div>
'Dashboard Title'
</div>- <div>
{t("extract-i18n.dashboardTitle)}
</div>
- <div>
- <div title="
Dashboard Title
" />- <div title=
{t("extract-i18n.dashboardTitle)}
/>
- <div title=
Modify the key prefix
This is default replace content:
t("extract-i18n.dashboardTitle)
Modify default value extract-i18n
-> dashboards
The new replacement will look like this:
t("dashboards.dashboardTitle)
The specified JSON file is generated in the nearest Locales directory,
eg: ["en","zh"] -> **/locales/en.json, **/locales/zh.json
The target's value (zh
) maybe is not a keyword for translate api, it should be zh-CN
default value: t("{{key}}")
default is use bing-translate-api
you can choose use custom service eg:
if engine is custom, translate will through this api to get result
request: fetch("${custom}?to=en&text=你好", { method: 'GET' }).then(response => response.text())