Metro-X uses the X Keyboard extension to support various keyboards. The keyboard description contains information about the physical layout of a keyboard, the key codes that come from the keyboard, and the symbol information needed to map the keycodes into keysyms.
Metro-X provides many predefined configurations, sorted by language and country. These configurations are selected through configX (section 5.4.3.