0

Maybe the title isn't to clear so let me explain a little bit.
I am using vue-i18n with Laravel and succesfully generated translation files too.
But in my translation file I used more that one word to translate. a snap of my messages
messages:{ "Your email"="Your email", "Email"=>"Email" }
Same with other language like thai language.
Inside of vue template when I use

{{ $t('messages.Email')}}

Translation works but when i use

{{ $t('messages.Your email')}}

It shows messages.Your email
Can anyone help me to use two or more word translation??
N.B: this works in Laravel blade though

{{ trans('messages.Your email') }}

Haque
  • 175
  • 2
  • 12

1 Answers1

3

You can access those properties with the usual bracket syntax.

Example in plain JS:

const object = { 'my key': 'ABC' }

object.my key //Syntax error
object['my key'] //ABC

In your case with vue-i18n:

{{ $t("messages['Your email']")}}
manniL
  • 7,157
  • 7
  • 46
  • 72