-, Angular Router Location ( , Router):
constructor(private router: Router, private location: Location) {}
, (base href):
let fullpath = this.location.prepareExternalUrl(this.location.path());
let basepath = fullpath.substr(0, fullpath.lastIndexOf(this.location.path().substr(1)));
, URL- ( urls):
const languages = ["en", "de", "fr", "it"];
let urls = [];
for (let lang of languages) {
let url = basepath.replace(/\/(..)\/$/, "/" + lang + "/") + this.location.path().substr(1);
if (url !== fullpath) {
urls.push(url);
}
}
, basepath.replace . - "en-us", . .