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

Translation of keys #267

Open yeco96 opened 7 years ago

yeco96 commented 7 years ago

Edit the map variable in the function symbolize, as is already templateTitle, cheatSheetDescription, etc.


hotkeysProvider.mapInit = { command: '\u2318', // ⌘ shift: '\u21E7', // ⇧ left: '\u2190', // ← right: '\u2192', // → up: '\u2191', // ↑ down: '\u2193', // ↓ 'return': '\u23CE', // ⏎ backspace: '\u232B', // ⌫ home: 'Inicio', end: 'Fin', space: 'Espacio', f2: 'F2' };


  var mapaInit = this.mapInit; // define in config

  function symbolize (combo) {
  -->  var map = mapaInit;

    combo = combo.split('+');

    for (var i = 0; i < combo.length; i++) {
      // try to resolve command / ctrl based on OS:
      if (combo[i] === 'mod') {
        if ($window.navigator && $window.navigator.platform.indexOf('Mac') >=0 ) {
          combo[i] = 'command';
        } else {
          combo[i] = 'ctrl';
        }
      }

      combo[i] = map[combo[i]] || combo[i];
    }

    return combo.join(' + ');
  }