chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 254 forks source link

i18n #258

Open spirau opened 7 years ago

spirau commented 7 years ago

If it's quite easy to use i18n for the key descriptions, it's more tricky for cheatSheet. Going thru the provider to set the cheatSheetDescription & templateTitle for example does'nt work because at this stage on starting the angular application, the user language is not known. Also it could change on the fly. The hotkeys variable like cheatSheetDescription are accessible anytime, but the content of theses variables has been cloned to the internal scope. So we need a clean way to late bind these variables or a way to modify the variables in the internal scope.

kroltan commented 6 years ago

Hi @spirau.

Quite late reply, but the way I've been doing it is by replacing the template entirely with one that contains translation directives. To translate the keycombos themselves (for example, ctrl is called strg in German, I patch the format function of the Hotkey prototype.

Sure, it's quite a bit hackish, but it works, considering this library is unmaintained.