import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.Cauyuiy8.js"; const __pageData = JSON.parse('{"title":"Language-specific Keycodes","description":"","frontmatter":{},"headers":[],"relativePath":"reference_keymap_extras.md","filePath":"reference_keymap_extras.md","lastUpdated":null}'); const _sfc_main = { name: "reference_keymap_extras.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('

Language-specific Keycodes

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 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 column below.

Selecting Your Host Keyboard Layout

To select a host keyboard layout, simply #include one of the keycode headers below at the top of your keymap.c. Example:

c
#include QMK_KEYBOARD_H\n\n#include "keymap_japanese.h"

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 tables.

json
{\n    "keyboard": "handwired/my_macropad",\n    "keymap": "my_keymap",\n    "host_language": "swedish", \n    "layout": "LAYOUT_all",\n    "layers": [\n        ["SE_ARNG"]\n    ]\n}

Sendstring Support

By default, SEND_STRING() assumes a US ANSI keyboard layout is set. If you are using a different layout, you can include one of the Sendstring LUT headers below in your keymap.c to override the lookup tables used for mapping ASCII characters to keycodes. You do not need to include the corresponding keymap_*.h header, as it is implicit when including the Sendstring header.

An important thing to note here is that SEND_STRING() only operates on ASCII text. This means that you cannot pass it a string containing Unicode characters - this unfortunately includes accented characters that may be present in your desired layout.
Many layouts make certain characters, such as Grave or Tilde, available only as dead keys, so you must add a space immediately after it in the string you want to send, to prevent it from potentially combining with the next character.
Certain other layouts have no Sendstring header as they do not use a Latin-derived alphabet (for example Greek and Russian), and thus there is no way to input most of the ASCII character set.

Header Files

These headers are located in quantum/keymap_extras/.

LayoutKeycodes HeaderSendstring LUT Header
Canadian Multilingual (CSA)keymap_canadian_multilingual.hsendstring_canadian_multilingual.h
Croatiankeymap_croatian.hsendstring_croatian.h
Czechkeymap_czech.hsendstring_czech.h
Czech (macOS, ANSI)keymap_czech_mac_ansi.hsendstring_czech_mac_ansi.h
Czech (macOS, ISO)keymap_czech_mac_iso.hsendstring_czech_mac_iso.h
Danishkeymap_danish.hsendstring_danish.h
Dutch (Belgium)keymap_belgian.hsendstring_belgian.h
English (Ireland)keymap_irish.h
English (UK)keymap_uk.hsendstring_uk.h
English (US Extended)keymap_us_extended.h
English (US International)keymap_us_international.hsendstring_us_international.h
English (US International, Linux)keymap_us_international_linux.h
Estoniankeymap_estonian.hsendstring_estonian.h
EurKEYkeymap_eurkey.h
Farsikeymap_farsi.h
Finnishkeymap_finnish.hsendstring_finnish.h
Frenchkeymap_french.hsendstring_french.h
French (AFNOR)keymap_french_afnor.hsendstring_french_afnor.h
French (BÉPO)keymap_bepo.hsendstring_bepo.h
French (Belgium)keymap_belgian.hsendstring_belgian.h
French (Canada)keymap_canadian_french.hsendstring_canadian_french.h
French (Switzerland)keymap_swiss_fr.hsendstring_swiss_fr.h
French (macOS, ISO)keymap_french_mac_iso.hsendstring_french_mac_iso.h
Germankeymap_german.hsendstring_german.h
German (Switzerland)keymap_swiss_de.hsendstring_swiss_de.h
German (macOS)keymap_german_mac_iso.hsendstring_german_mac_iso.h
German (Neo2)keymap_neo2.h
Greekkeymap_greek.h
Hebrewkeymap_hebrew.h
Hungariankeymap_hungarian.hsendstring_hungarian.h
Icelandickeymap_icelandic.hsendstring_icelandic.h
Italiankeymap_italian.hsendstring_italian.h
Italian (macOS, ANSI)keymap_italian_mac_ansi.hsendstring_italian_mac_ansi.h
Italian (macOS, ISO)keymap_italian_mac_iso.hsendstring_italian_mac_iso.h
Japanesekeymap_japanese.hsendstring_japanese.h
Koreankeymap_korean.h
Latviankeymap_latvian.hsendstring_latvian.h
Lithuanian (ĄŽERTY)keymap_lithuanian_azerty.hsendstring_lithuanian_azerty.h
Lithuanian (QWERTY)keymap_lithuanian_qwerty.hsendstring_lithuanian_qwerty.h
Norwegiankeymap_norwegian.hsendstring_norwegian.h
Polishkeymap_polish.h
Portuguesekeymap_portuguese.hsendstring_portuguese.h
Portuguese (macOS, ISO)keymap_portuguese_mac_iso.hsendstring_portuguese_mac_iso.h
Portuguese (Brazil)keymap_brazilian_abnt2.hsendstring_brazilian_abnt2.h
Romaniankeymap_romanian.hsendstring_romanian.h
Russiankeymap_russian.h
Serbiankeymap_serbian.h
Serbian (Latin)keymap_serbian_latin.hsendstring_serbian_latin.h
Slovakkeymap_slovak.hsendstring_slovak.h
Sloveniankeymap_slovenian.hsendstring_slovenian.h
Spanishkeymap_spanish.hsendstring_spanish.h
Spanish (Dvorak)keymap_spanish_dvorak.hsendstring_spanish_dvorak.h
Spanish (Latin America)keymap_spanish_latin_america.hsendstring_spanish_latin_america.h
Swedishkeymap_swedish.hsendstring_swedish.h
Swedish (macOS, ANSI)keymap_swedish_mac_ansi.h
Swedish (macOS, ISO)keymap_swedish_mac_iso.h
Swedish Pro (macOS, ANSI)keymap_swedish_pro_mac_ansi.h
Swedish Pro (macOS, ISO)keymap_swedish_pro_mac_iso.h
Turkish (F)keymap_turkish_f.hsendstring_turkish_f.h
Turkish (Q)keymap_turkish_q.hsendstring_turkish_q.h
Ukrainiankeymap_ukrainian.h

There are also a few which are not quite language-specific, but useful if you are not using a QWERTY layout:

LayoutKeycodes HeaderSendstring LUT Header
Colemakkeymap_colemak.hsendstring_colemak.h
Dvorakkeymap_dvorak.hsendstring_dvorak.h
Dvorak (French)keymap_dvorak_fr.hsendstring_dvorak_fr.h
Dvorak (Programmer)keymap_dvorak_programmer.hsendstring_dvorak_programmer.h
Normankeymap_norman.hsendstring_norman.h
Ploverkeymap_plover.h
Plover (Dvorak)keymap_plover_dvorak.h
Workmankeymap_workman.hsendstring_workman.h
Workman (ZXCVM)keymap_workman_zxcvm.hsendstring_workman_zxcvm.h
', 16); const _hoisted_17 = [ _hoisted_1 ]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("div", null, _hoisted_17); } const reference_keymap_extras = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { __pageData, reference_keymap_extras as default };