I forgot to reply, but given these keyCodes I see that there is no overlap between the QWERTY and AZERTY keycodes and the directions, the combinations keyCode/directions are all unique. In other words there is no keyCode used for one certain direction in QWERTY and a different direction in AZERTY.
So… there is no need to distinguish between the two keyboard layouts and I just do this
onKeyDown: function(evt) {
var dir = DIR_NONE;
// cursors
if (evt.keyCode === 38) dir = DIR_UP; // cursor up
if (evt.keyCode === 40) dir = DIR_DOWN; // cursor down
if (evt.keyCode === 37) dir = DIR_LEFT; // cursor left
if (evt.keyCode === 39) dir = DIR_RIGHT; // cursor right
// WASD
if (evt.keyCode === 87) dir = DIR_UP; // W
if (evt.keyCode === 83) dir = DIR_DOWN; // S
if (evt.keyCode === 65) dir = DIR_LEFT; // A
if (evt.keyCode === 68) dir = DIR_RIGHT; // D
// ZQSD azerty keyboard support
if (evt.keyCode === 90) dir = DIR_UP; // Z
//if (evt.keyCode === 83) dir = DIR_DOWN; // S same as QWERTY
if (evt.keyCode === 81) dir = DIR_LEFT; // Q
//if (evt.keyCode === 68) dir = DIR_RIGHT; // D same as QWERTY
// handle input
// etc.
};