-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refacto language + add navigator preferences (#349)
* feat: initialize with navigator language * rename: use language instead of locale * feat: set language as DOM property for external use * refacto: change language without reload + external language setter * feat: remove side menu language selector * fix comments * let localstorage empty if not explicitly select language * lint * refacto localStorage logic Signed-off-by: Louis Greiner <[email protected]> * add validation for localStorage getter Signed-off-by: Louis Greiner <[email protected]> --------- Signed-off-by: Louis Greiner <[email protected]>
- Loading branch information
1 parent
e0330ff
commit 338b69f
Showing
5 changed files
with
109 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import {Pipe, PipeTransform} from "@angular/core"; | ||
import {I18n} from "./i18n.service"; | ||
import {I18nService} from "./i18n.service"; | ||
|
||
@Pipe({ | ||
name: "translate", | ||
pure: false | ||
}) | ||
export class TranslatePipe implements PipeTransform { | ||
constructor(private i18n: I18n) {} | ||
constructor(private i18nService: I18nService) {} | ||
|
||
transform(key: string, params?: any): string { | ||
return this.i18n.translate(key, params); | ||
return this.i18nService.translate(key, params); | ||
} | ||
} |