I just started using Angular i18n, I managed to get it working, however it generates one build for each language and I don't know how to access them.
I am currently doing this:
<div *ngIf="languageCode =='en' || languageCode == 'en-US' else englishlanguage">
<a href="lang/es/index.html">ES</a>
</div>
<ng-template #englishlanguage>
<a href="../../index.html">EN</a>
</ng-template>
So this redirects me to the folder lang
, inside dist
, which contains the es
folder with all builds for that language. The solution works but I think it's not a good one.
So here's my question: is there any better way of doing that? Is there something like a router like myapp/es and then it redirects to the folder lang/es
in dist
folder?
CodePudding user response:
I would recommend looking into https://github.com/ngx-translate/core if you want to integrate i18n in a maintainable and centralized way.