0
votes

I am in need to use translations for API responses (especially error messages)

Ex:

1) User name invalid for [email protected]
2) Password is incorrect for [email protected]
3) Login Success for [email protected]

I used i18n select for this purpose. My sample code is below:

<span i18n="@@common_error">{respError, select, User name invalid for {User name invalid for} Password is incorrect for { Password is incorrect for}}</span>

respError - is a variable which holds backend response

Here I am parsing the string and then comparing using i18n select which is working fine. But I am in need to add the dynamic email in the message. I tried to add like this

{User name invalid for {Email}}, but no luck.

Is there any other way to use variables inside {} - braces.

1

1 Answers

0
votes

There is one example from the documatation that might help:

<span i18n>Updated {minutes, plural, =0 {just now} =1 {one minute ago} other {{{minutes}} minutes ago}}</span>

From the above example, it looks like you can try to use double curly brackets instead of single:

{User name invalid for {{Email}}}