Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
fix(core): fix improper route translations on pipe (#31)
Browse files Browse the repository at this point in the history
* fix(core): prevent `getTranslation` from using `lodash.get`

Fixes #10
  • Loading branch information
Burak Tasci authored Sep 6, 2017
1 parent 0f9eba2 commit 7df5381
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/@ngx-i18n-router/core/src/i18n-router.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export class I18NRouterService {
getTranslation(key: string): string {
key = key.replace(/-/, '_');

return _.get(this.translations, `${this.languageCode}.${key.toUpperCase()}`, undefined);
if (!this.translations[this.languageCode][key.toUpperCase()])
return undefined;

return this.translations[this.languageCode][key.toUpperCase()];
}

translateRoutes(routes: Routes, moduleKey = ''): Routes {
Expand Down

0 comments on commit 7df5381

Please sign in to comment.