I mostly write in English (plus Clojure, shell, and C#), but often also in Spanish, French and Finnish. I've found that a standard QWERTY/US layout with a Compose key is the best option. It gives you a decent layout for coding and shell related characters, and all diacritics (and plenty more) are a 3 keystroke chain away (with no chording). Even when writing French, which requires a lot of accents, I find it more flu…
Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
131–140 of 212 posts
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#132Earlier quoted context omitted.
We all suffer from character blindness of some sort. For you: ` - that thing isn't formally defined in English either as far as I know. In English we don't have any diacritics. We do have a few extra symbols, beyond the alphabet for certain situations. Quotations ... " ... meh should be 66 99 and that will be fixed up by DTP software. We use ' to denote a dropped letter - abbreviation. There are a few others. I won't…
It's the grave accent - pretty rare in English outside of loan words from other languages. https://en.wikipedia.org/wiki/Grave_accent#English
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#133As a kid, I remember being utterly confused, when most games with a console would have the key ` to open it. WTF is the key ` and where is it? For a kid it wasn't that easy to understand that there are such things as different keyboard layouts. Turns out that ` is a single key press to the left of the '1', in English, while it is a bit obscure character to write in other languages. In mine, you have º and ª in that p…
I remember that too. But the console you only open sometimes. But everyday(!), I have to use {[(| ... and they are just awkward to reach on a german layout.
I have learned on the US keyboard and keep using it more or less.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#134TL;DR. Don't use keypress, it's deprecated. Don't use 'keyCode', 'which', 'char' which are all deprecated. Do use 'key' Another issue I run into is forms that dismiss via keydown and escape. I type in Japanese which means I'm using an IME. An IME, or at least the Japanese IME, you type characters and they appear with possible completions. They haven't actually been given to the app yet. Pressing Escape cancels the co…
The article mentions an open-source example that does it this way and works fine on international layouts: Discourse
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#135> For example, on my German layout, / is produced via Shift+7. This is my #1 annoyance with German keyboards as someone who learned a UK layout and who needs to do lots of programming and terminal hacking (#2 is the swapping of Y and Z). I take it this layout was invented before Unix and its heavy use of forward slashes, but it does show how shortcuts are rather discriminatory. I know more than a few Germans who use…
I'm Chilean and I use the ANSI US layout because /, are much easier to type than using ISO keyboards. When I need to type Spanish characters like áéíóú, ñ, etc. I switch to latin american ISO layout using WIN + Spacebar and then switch back.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#136They had me until: > This means when the key combination is alt+/, the shortcut should be triggered when a german layout user presses alt+shift+7. No way. I want to press alt+dash, which is in the same place as alt+/ on a US keyboard. Pressing alt+shift+7 is the equivalent of Lee-Harvey-Oswald-grade marksmanship on a keyboard.
However, developers defining and documenting alt+/ as an alternative for alt+/ when registering the binding would indeed be a fine solution.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#137The best solution would be to actually allow users to change the keyboard shortcuts on the software they use.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#138There is also a whole slew of issues with Polish characters. Polish keyboard setup relies on "right-alt" and a letter to get it's diacritics variation. Ie: 'ą' is 'right-alt'+a Windows for backwards compatibility reports 'right-alt' as 'alt+control'. Many applications developers assign key combos with no negative checks. So 'ctrl-s', typically used for save gets triggered when user wants to type 'ś'. To repeat, "righ…
Really shows how useful macs having 4 modifier keys (versus PC’s 3) is. Also the better (though not perfect) matching of scopes and modkeys: on macs, command / control / option tend to affect different system areas entirely (with command taking precedence, then control, although control and option are rarely used together).
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#139The author spends a lot of time explaining the APIs that have been deprecated but doesn’t say which one is the correct one to use now...
Regarding events, attributes, and deprecation: keydown (event), code (attribute), and key (attribute) are not deprecated.
Re: Why keyboard shortcuts don't work on non-US layouts and how devs could fix it
#140It's not just international keyboards that are affected by this. I'm a Dvorak user so I run into these issues from time to time. As the article explains, there is a difference between the physical keyCode and character it corresponds to. Which to use really depends on what it is being used for, and there are situations for both. The article suggests checking the character typed, but this is not always the correct way…
> For instance, the most annoying are games which default to WASD based on the letter typed and not the physical keys Is it even possible to do anything else? I can’t imagine keyboards report their physical layout..
If you type WASD on a US layout USB keyboard, the computer will receive key codes 26, 4, 22, 7.
If you type ZQSD on a French keyboard you get exactly the same result.
So if you are writing a game, you might listen for codes 26, 4, 22, 7 and these will be in the sample place on the keyboard regardless of layout. You can ask the OS to translate these codes to letters for help text.
(Some of the details here are omitted—the codes above are USB HID codes, but those go through an additional OS-specific translation table before they are sent to your program.)