I need to internationalize a ternary expression with i18n in Angular. How to do this?
<ion-title i18n>{{currentStep === 0 ? 'New chat' : 'New room'}}</ion-title>
I need to internationalize a ternary expression with i18n in Angular. How to do this?
<ion-title i18n>{{currentStep === 0 ? 'New chat' : 'New room'}}</ion-title>
Quentin Portet
On
I would recommend creating two new translation keys then using either of those depending on the result of your ternary expressions's condition.
If that seems impossible, maybe check out ngx-translate if your environment allows using it. That would allow using translate pipes and/or instant translation of variables in situations like this one.
Copyright © 2021 Jogjafile Inc.
Ok, I got it. We can rewrite this expression in non-ternary and apply i18n directive.