How to provide an alternate i18n language link in Angular with aot compiling?

Viewed 1531

I am currently working on i18n of my Angular app. I use AOT compiling with xlf files to create pre-compiled apps as described here. In the build, I provide a language specific base href (using the --base-href parm). For example, this means, I end up with two language specific apps using the following url paths:

  • /app_path/en/...
  • /app_path/de/...

Now I want to provide a link to the respective alternate language within my app by replacing for example en by de in the active url. I used the Router injection, so I can access its url property, but this property does not give me the full url including the base-href.

How can I find out the base url from within an Angular app?

Alternatively, is there a way to I find out language the app was built for? Can I access the target-language property from the xliff files somehow?

2 Answers
Related