I am Developing Angular Application for Demo purpose and I have implemented Book Store Application , basic Web Api in C# and other.
Now I am using Angular i18n utility to make my Application in french and turkish. I refer to Angular documentation and worked for label, text input and for placeholder. But I have implemented Reactive forms for Sign up and Sign in page. It has various custom Validations based on user input it generates error messages using interpolation by binding different error messages.
How to transalate different messages based on message. ie. error message is "username must be required" so it should be translated in french and if error message is "Email must be required" it should be translated in french.
I have searched for Interpolation and tried based on document but I could not able to find solution.
<div>
<p *ngIf="messageerrors" style="color:red" i18n>{{messageerrors}}</p>
</div>
messageerrors : string = '';
this.messageerrors = "username must be required";
this.messageerrors = "Email must be required";
<!--message.xlf file-->
<trans-unit id="144f3b27d028b0f3d2f79e9ad8996f73703778b3" datatype="html">
<source>
<x id="INTERPOLATION" equiv-text="{{messageerrors}}" />
</source>
<target>
<x id="INTERPOLATION" equiv-text="{{messageerrors}}" />
</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/login/login.component.html</context>
<context context-type="linenumber">8</context>
</context-group>
this.messageerrors = "username must be required"; should show error message as "nom d'utilisateur doit ĂȘtre requis in french."
this.messageerrors = "Email must be required"; should show error message as
"Email doit ĂȘtre requis"enter code here