Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vue-i18n - Detect 'unknown' type of token

When trying to interpolate values in my translation string using vue-i18n I keep getting this error:

Detect 'unknown' type of token

My messages.json looks as follows:

{ test: 
  { "at_location": "At { name }" }
}

Usage:

<p>
  {{ $t('test.at_location', { name: location.name }) }}
</p>

Here location.name is defined perfectly fine, so I wonder what's going wrong...

like image 292
Raymundus Avatar asked Sep 14 '18 06:09

Raymundus


1 Answers

Interpolations in translation messages should not contain spaces.

Change your messages to:

{ test: 
  { "at_location": "At {name}" } // No spaces!
}
like image 104
Raymundus Avatar answered Oct 15 '22 19:10

Raymundus