Is there a way to easily add an i18n string to a .vue file?
Ok, here’s how I figured it out:
- Go into the project folder and create a
.vscode
folder (if it doesn’t exist) then create a snippet file inside the .vscode folder like this:i18n-snippet.code-snippets
. - Add the following code to the snippet file:
{
"i18n": {
"prefix": "i18n",
"body": [
"{{ \$t('$1') }}"
],
"description": "Create an i18n snippet"
}
}
- You can now easily create an i18n template tag in your vue file. Just type
i18n
(or just i1) in your vue file