openstreetmap / iD

🆔 The easy-to-use OpenStreetMap editor in JavaScript.
https://www.openstreetmap.org/edit?editor=id
ISC License
3.38k stars 1.21k forks source link

Localize keyboard button texts (e.g. "Ctrl" -> "Strg") #4090

Open manfredbrandl opened 7 years ago

manfredbrandl commented 7 years ago

There is one untranslatable item at Browsing "Enter full screen mode". Maybe you can make some button-texts translatable: "Ctrl", "Space", "PgUp", "PgDn", "Home", "End", "Backspace" maybe even those I would use the same Text in German as in English: "Shift", "Pause", "Alt", "Enter", "Esc"

image

bhousel commented 7 years ago

re: "Enter full screen mode": I just added it last night. It should be picked up by Transifex today and be available for translation soon. If you see it tomorrow we can close this issue 👍

bhousel commented 7 years ago

Sorry just read again and it looks like you also want the button texts translatable too, I agree this is a good idea.

manfredbrandl commented 7 years ago

@bhousel 'full screen mode' arrived at transifex, thanks. Waiting for 'Ctrl' etc.

bhousel commented 7 years ago

I've added the localizable button labels in c22fa60. These will appear on Transifex within the next day, and when they do, I'll add some translation instructions.

While it works for the "Keyboard shortcuts" screen, localization won't work yet in the popup tooltips. This is because iD.uiCmd() works a little differently than the iD.uiCmd.display() function that I added for the keyboard shortcuts. iD.uiCmd() generates a code in a specific way that a regex in d3.keybinding.js parses, so swapping e.g. "Ctrl" to "Strg" would mess it up.

Still trying to think of how I can reconcile the two approaches. Probably some combination of:

  1. iD.uiCmd should not do any display-focused translations, only conversions between win-mac-linux,
  2. use iD.uiCmd.display() everywhere we want a displayable code (like tooltips), and
  3. change iD.uiCmd.display from accepting single character codes to accept a string (e.g. "⌘A"), and return an array of keys found in it (e.g. ['⌘ Cmd', 'A']).
  4. maybe make another function to take that array and wrap those things in <kbd> tags and join with <span>+</span>
manfredbrandl commented 7 years ago

The localizable button labels arrived at transifex

bhousel commented 7 years ago

Thanks! I'm leaving it open until I can fix how the shortcuts are displayed in tooltips.

manfredbrandl commented 6 years ago

@bhousel Do you mean that you also want to display "Strg" + "<- Rück" here: image

bhousel commented 6 years ago

Do you mean that you also want to display "Strg" + "<- Rück" here:

Yes!

manfredbrandl commented 4 years ago

@bhousel is this still on your agenda?