Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I access the language folders generated by angular i18n?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

I would recommend looking into https://github.com/ngx-translate/core if you want to integrate i18n in a maintainable and centralized way.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading