9

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...

Raymundus
  • 2,173
  • 1
  • 20
  • 35

1 Answers1

21

Interpolations in translation messages should not contain spaces.

Change your messages to:

{ test: 
  { "at_location": "At {name}" } // No spaces!
}
Raymundus
  • 2,173
  • 1
  • 20
  • 35