Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork30.7k
Using i18n#3939
Unanswered
AndresDiazG asked this question inQ&A
Using i18n#3939
-
May I ask how to use the i18n component we all see on the demo project? I liked the view and I can see a lot of uses of it in my website but I can't find it on the Master branch or in any other branch this project has. Thanks AD. |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment
-
Hi In order to use i18n, you need to add translations in the language files in this dir //en.js English translationexportdefault{response:{accept:'yes',deny:'no',doubt:'maybe'}} //es.js Spanish translationexportdefault{response:{accept:'sí',deny:'no',doubt:'quizás'}} then I can access them in vue template by: <template> <div> <ul> <li>{{ $t('response.accept') }}</li> <li>{{ $t('response.deny') }}</li> <li>{{ $t('response.doubt') }}</li> </ul> </div></template><script>exportdefault {mounted() {console.log(this.$t('response.accept')) } }</script> Make sure to have i18n imported in the index.js file importi18nfrom'./lang' In a js file, I can access it by: importi18nfrom'~/lang'constaccept=i18n.t('response.accept')exportdefaultaccept |
BetaWas this translation helpful?Give feedback.
All reactions
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment