Question

I can use data-18n no problem with a json properties file like this:

<div data-i18n="errIncorrectSpecies"></div>

json properties file has this entry:

"errIncorrectSpecies":"You have selected incorrect species tests."

How I go about putting dynamic params into the "errIncorrectSpecies" value? I would like to do this in my json file:

"errIncorrectSpecies":"You have selected {0} tests for this {1}."

Just not sure how to pass in "{0}" and "{1}"...

Was it helpful?

Solution

Looks like I can do it like this in my html file...

<div>{{i18n('errIncorrectSpecies', {'0':'test','1':'test2'})}}</div>

I'm going to see if I can do this programmatically in my angular directive instead of in the HTML.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top