javisperez/vuetranslate

Getting text from globally translation file set

LeonardoSSev opened this issue · 3 comments

I have a file that loads the translation plugin as it's set on the example:

Vue.use(VueTranslate);

Vue.locales({
	spanish: {
		'hello-world': 'hola mundo'
	}
        pt-br: {
                'hello-wolrd': Olá mundo
});

But I how do I get the hello-world in pt-br translation, for example?

I tried something like this.$translate.text('hello-world') on my script but it just appear hello-world instead of 'hola mundoorOlá mundo` when it's set as pt-br.

Isn't there a typo? wolrd

@LeonardoSSev Thanks for the issue. As @tonn-talvik says, you have a typo there, please confirm if that fixes it. Thanks!

Thanks for that observation, @tonn-talvik and @javisperez . Although I had written wrongly, the problem wasn't solved after I fixed the typo.
But I got the answer for what I needed. The translated string can be got through this.t('hello-world'); inside <script> tags.