Here's an example of using vue-i18n
in TypeScript:
npm install vue-i18n
i18n.ts
in your project:index.ts273 chars22 lines
i18n
instance and use it like this:index.ts292 chars17 lines
Here we use the $t
function provided by vue-i18n
to translate the string hello
according to the current locale.
Note: make sure to configure your TypeScript compiler to recognize .vue
files, or use .ts
files instead of .vue
files for your components.
gistlibby LogSnag