[x] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
Current behavior
Hello guys,
I updated all my i18n-router modules to last release and i got a problem with the I18NRouterPipe.
It doen't seems to work (for me at least) anymore.
Routes doesn't seems to be translated anymore, exemple for this :
-> [routerLink]="['visit'] | i18nRouter", the route that is retreived is "/visit" even if my default language is /fr. We should have seen "/fr/visiter".
I found that is because we uses now lodash's get method now for routes translations
_.get(this.translations, this.languageCode + "." + key.toUpperCase(), undefined); (l.42 of i18n-router.services.js).
Lodash itself uses :
path = castPath(path, object); (l.3040) which split path to iterate over and find correct translation.
The problem is using this kind of config structure into config.json file:
if we want to keep using lodash way.
Or keep using the old way into i18n-router.service :
if (!this.translations[this.languageCode][key.toUpperCase()])
return undefined;
return this.translations[this.languageCode][key.toUpperCase()];
I could be wrong so let me know ^^'.
I also reproduice this case using ng-seed/spa
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
If am right, It could be great to update documentation about configurations settings config.json and the
ng-seed/spa.
I'm submitting a ... (check one with "x")
Current behavior Hello guys, I updated all my i18n-router modules to last release and i got a problem with the I18NRouterPipe. It doen't seems to work (for me at least) anymore. Routes doesn't seems to be translated anymore, exemple for this : -> [routerLink]="['visit'] | i18nRouter", the route that is retreived is "/visit" even if my default language is /fr. We should have seen "/fr/visiter".
I found that is because we uses now lodash's get method now for routes translations
_.get(this.translations, this.languageCode + "." + key.toUpperCase(), undefined);
(l.42 of i18n-router.services.js).Lodash itself uses :
path = castPath(path, object);
(l.3040) which split path to iterate over and find correct translation.The problem is using this kind of config structure into config.json file:
path is an array(3) like this : 0:"fr" 1:"ROOT" 2:"VISIT"
The translation will never be found because our key "ROOT.VISIT" is splited.
Expected/desired behavior If am not wrong, we should now uses this structure :
if we want to keep using lodash way. Or keep using the old way into i18n-router.service :
I could be wrong so let me know ^^'. I also reproduice this case using ng-seed/spa
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior? If am right, It could be great to update documentation about configurations settings config.json and the ng-seed/spa.
Environment
Angular version: 4.2.3
Angular-CLI version: 1.1.1
Browser:
[ ] Chrome (desktop) version XX
[ ] Chrome (Android) version XX
[ ] Chrome (iOS) version XX
[ ] Firefox version XX
[ ] Safari (desktop) version XX
[ ] Safari (iOS) version XX
[ ] IE version XX
[ ] Edge version XX
For Tooling issues:
Node version: XX <!-- run
node --version
-->Platform:
Others:
"@ngx-config/core": "^0.2.0-rc.5",
"@ngx-config/http-loader": "^0.2.0-rc.1",
"@ngx-i18n-router/config-loader": "^0.2.0-rc.3",
"@ngx-i18n-router/core": "^0.4.0-beta.1",
"@ngx-meta/core": "^0.4.0-rc.2",
"@ngx-translate/core": "^6.0.1",
"@ngx-translate/http-loader": "0.0.3",