Yoann Augen
Yoann Augen

Reputation: 2036

Pass a i18n text as component parameter in Angular2

I want to inject a translated text into a component.

<my-component [text]="_A_TRANSLATED_TEXT_" />

Following the doc, https://angular.io/docs/ts/latest/cookbook/i18n.html, I don't find this kind of basic feature. Any idea how to do?

Thank

Upvotes: 2

Views: 906

Answers (1)

Yoann Augen
Yoann Augen

Reputation: 2036

It seems possible to use this kind of syntax

<app-mycomp 
    i18n 
    param="my param" i18n-param
    another_param="my param" i18n-another_param>
my text
</app-mycomp>

So i18n will affect to content of the tag, and i18n-* will affect the corresponding attribute. Seem not documented yet.

Upvotes: 4

Related Questions