Reputation: 289
I am using translate.instant and making a string concatenation like that
var variable = this.$translate.instant('project.discount') + " % " + this.$translate.instant('project.applied_to') + " " +this.office;
how can I do that inside one $translate.instant as string interpolation instead of concatenation
Thanks,
Upvotes: 2
Views: 4797
Reputation: 958
I think what you want is
var variable = this.$translate.instant('project.discountAndAppliedTo', {office: this.office});
Assuming
{
"project.discountAndAppliedTo": "discount % applied to {{office}}"
}
Or something like that, with the key point being your interpolation variable name in {{}} in the translated value.
Upvotes: 5