Hi,
I’m creating a complete i18n App.
With the ng2-translate package I have developed the majority of pages. The problem is when I want to have different pages depending on the language such as legal texts depending on the language.
The solution I have used is to create 3 components called legal-es, legal-fr and legal-en. In each component I have added the corresponding texts, images and links.
In the legal page I added the three components and using a language variable I show one component or another.
<h1>Legal
<legal-es *ngIf="my_lang=='es'"></legal-es>
<legal-en *ngIf="my_lang=='en'"></legal-en>
<legal-fr *ngIf="my_lang=='fr'"></legal-fr>
</h1>
I have searched how to load templates dynamically but I have not found a solution. Something like:
@Component({
selector: ‘page-legal’,
templateUrl: ‘legal.html’
})
or a partial page like Ionic 1.
Is there a more elegant alternative? Some code is welcomed.
Best regards