Closed alexei-petru closed 12 months ago
I am changing only the lang and not translating the full URL so i don't know if I really need this library tbh.
public setLang(langObj: LanguageApp) {
this.languageApp.next(langObj);
this.translate.use(langObj.value);
this.changeRoute(langObj.value);
}
private changeRoute(lang: LanguageAppValues) {
// use because of ngx-translate-route lazy modules bug
const currentUrl = this.router.url;
const urlParts = currentUrl.split('/');
if (LANGUAGES_ALL_VAL_ARR.includes(urlParts[1])) {
urlParts[1] = lang;
const newUrl = urlParts.join('/');
console.log(newUrl);
this.router.navigateByUrl(newUrl);
}
}
private changeRoute(lang: LanguageAppValues) { // use because of ngx-translate-route lazy modules bug const currentUrl = this.router.url; const urlParts = currentUrl.split('/'); if (LANGUAGES_ALL_VAL_ARR.includes(urlParts[1])) { urlParts[1] = lang; const newUrl = urlParts.join('/'); console.log(newUrl); this.router.navigateByUrl(newUrl); } }
I don't understand... Why use this library if ngx-translate already solves your use case?
@jemys89 I was thinking maybe I would use other functionality from it later. But I will make manually for the moment. Still, I think there is a bug with lazy loaded modules.
@jemys89 I was thinking maybe I would use other functionality from it later. But I will make manually for the moment. Still, I think there is a bug with lazy loaded modules.
Yes, there is a critical bug, after updating to Angular 16, in the (lazy modules) the path is concatenated twice.
Since he/she does not respond and I urgently need the fix, I have created this provisional fork, until he/she accepts the PR I have made.
Since he/she does not respond and I urgently need the fix, I have created this provisional fork, until he/she accepts the PR I have made.
Good job, thank you.
I better leave it open until the pr will be accepted.
Can you check it's correctly fixed on version 7.0.0
?
Can you check it's correctly fixed on version
7.0.0
?
@gilsdav Everything good, thank you and everyone involved for fixing it.
Issue with lazy loading a module
It looks like a major issue, I am using it wrong or ? Can someone help and give a good solution?
this is fine
this is NOT fine
parent
childrens