Skip to content

Commit

Permalink
docs: move description of host_language from Macros to Language-speci…
Browse files Browse the repository at this point in the history
…fic Keycodes (#24584)

Co-authored-by: フィルターペーパー <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: Ryan <[email protected]>
  • Loading branch information
4 people authored Nov 15, 2024
1 parent 46236ce commit f4e58ee
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 34 deletions.
33 changes: 1 addition & 32 deletions docs/feature_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,7 @@ You can define up to 32 macros in a `keymap.json` file, as used by [Configurator

### Selecting Your Host Keyboard Layout

If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros - you may need to type different keys to get the same letters! To address this you can add the `host_language` key to your `keymap.json`, like so:

```json
{
"keyboard": "handwired/my_macropad",
"keymap": "my_keymap",
"host_language": "dvorak",
"macros": [
["Hello, World!"]
],
"layout": "LAYOUT_all",
"layers": [
["QK_MACRO_0"]
]
}
```

The current list of available languages is:

| belgian | bepo | br_abnt2 | canadian_multilingual |
|:-------:|:----:|:--------:|:---------------------:|
| **colemak** | **croatian** | **czech** | **danish** |
| **dvorak_fr** | **dvorak** | **dvp** | **estonian** |
| **finnish** | **fr_ch** | **french_afnor** | **french** |
| **french_osx** | **german_ch** | **german** | **german_osx** |
| **hungarian** | **icelandic** | **italian** | **italian_osx_ansi** |
| **italian_osx_iso** | **jis** | **latvian** | **lithuanian_azerty** |
| **lithuanian_qwerty** | **norman** | **norwegian** | **portuguese** |
| **portuguese_osx_iso** | **romanian** | **serbian_latin** | **slovak** |
| **slovenian** | **spanish_dvorak** | **spanish_latin_america** | **spanish** |
| **swedish** | **turkish_f** | **turkish_q** | **uk** |
| **us_international** | **workman** | **workman_zxcvm** |
If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros — you may need to type different keys to get the same letters! To address this you can use [language-specific keycodes](reference_keymap_extras).

### Macro Basics

Expand Down
26 changes: 24 additions & 2 deletions docs/reference_keymap_extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,31 @@

Keyboards are able to support a wide range of languages. However, this support is not actually achieved within the keyboard itself - instead, it sends numerical codes, which the operating system maps to the appropriate characters depending on the user's configured keyboard layout. By default (and per the HID spec), this is the US ANSI layout. For example, when a Swedish person presses the key with the `å` character printed on it, the keyboard is *actually* sending the keycode for `[`.

Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap.
Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These are used in place of the `KC_` prefixed ones. They won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap. The language-specific keycode aliases are defined in the files listed in the [Keycodes Header](#header-files) column below.

Simply `#include` one of the keycode headers below at the top of your `keymap.c`, and assign the keycodes defined in the header in place of the `KC_` prefixed ones.
## Selecting Your Host Keyboard Layout

To select a host keyboard layout, simply `#include` one of the [keycode headers](#header-files) below at the top of your `keymap.c`. Example:

```c
#include QMK_KEYBOARD_H

#include "keymap_japanese.h" // [!code focus]
```

Alternatively, if using `keymap.json`, add the `host_language` key as shown in the following example. The available languages are those with a _Sendstring LUT Header_ entry in one of the [Header Files](#header-files) tables.

```json
{
"keyboard": "handwired/my_macropad",
"keymap": "my_keymap",
"host_language": "swedish", // [!code focus]
"layout": "LAYOUT_all",
"layers": [
["SE_ARNG"]
]
}
```

## Sendstring Support

Expand Down

0 comments on commit f4e58ee

Please sign in to comment.