Issue
I studied the new i18n feature in Angular 9. https://angular.io/guide/i18n
How to translate text in TypeScript, e.g. SnackBar messages?
Solution
Check this blog https://blog.ninja-squad.com/2019/12/10/angular-localize/
UPDATE FOR 2022
From Offical Doc: https://angular.io/api/localize
@Component({
template: '{{ title }}'
})
export class HomeComponent {
title = $localize`You have 10 users`;
}
And
You have to manually add it to your messages.fr.xlf
<trans-unit id="6480943972743237078">
<source>You have 10 users</source>
<target>Vous avez 10 utilisateurs</target>
</trans-unit>
don't forgot re serve your angular application.
UPDATE FOR ID
@Component({
template: '{{ title }}'
})
export class HomeComponent {
title = $localize`:@@6480943972743237078:`;
}
Answered By - Muhammet Can TONBUL
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.