How to use i18n plugin #36
niutech
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you want to use internationalization (i18n) plugin to provide translations with Petite Vue, I recommend using my Petite Vue I18n Lite. It's a piece of cake!
First, add it by running:
yarn add petite-vue-i18n-lite
Then add the following script:
Now you can use it your HTML like this:
<p v-t="'message'">Fallback message</p>
or<p>{{t('message')}}</p>
.The
v-t
directive is optional and you can safely skip it if you wish not to use the fallback whenever JS in disabled.You can get the current locale simply by inserting
{{current}}
and change the locale by invokingchangeLocale('en')
.Beta Was this translation helpful? Give feedback.
All reactions