How to deal with keyboard layouts?

Keyboard Localization Issue in Unreal Engine

Hello,

I have an issue that’s driving me crazy, and its keyboard localization for input handling.

I am a beginner in Unreal Engine (love it so far), so please go easy on me.

The Problem

Some countries have different keyboard layouts.

Problematic layouts are for example: QWERTZ, AZERTY, QZERTY, Dvorak, Colemak and more

Let’s take the number keys on top of the keyboard as an example. Here is a list of how the 1-0 keys are localized in some countries:

Country Key Layout
Czech +ěščřžýáíé=´
Slovak +ľščťžýáíé=´
Hungarian 0'-.,§!"+%/=
Slovenian +čščđžqwertz
Croatian +čćžđšđžćč-'

When using these localizations, Unreal Engine mappings for 1-0 keys stop working as expected.

Blueprint with Enhanced Input

  • You have InputActions for your actions.
  • You have an InputMappingContext with these actions set to keys.
  • If you set an input action within the context to a key like 1, it does not work on localized keyboards.

C++ Key Binding

The same issue occurs with C++ key bindings. For example:

InputComponent->BindKey(EKeys::One, IE_Pressed, this, &AGamePlayerController::LogNumKey<1>());

This works with English keyboards but not with the localized variants mentioned above.

Possible (but not ideal) solution

There is an easy way to fix this using a plugin called Loonyware - Keyboard Layout-Independent Input. However, this is a paid plugin and adds another dependency to your project. I wish to avoid using it and fix it via native Unreal Engine functionality.

I have tried finding a solution for this issue, but I could not find any useful resources or information on the matter.

Please help me out. I am sure there must be a easy way to do this that I am missing.

Thank you

i’ve been using dvorak for more than 15 years. i’d also would like to know.
i’m not entirely sure i haven’t dived into this myself yet.

with the enhanced input system you can have different imcs depending on the layout. you might need to specify each layout separately though.

What if you map to num pad keys and give player the option to remap the other keyboard keys?

Have you seen these websites?

Keyboard Layout Info

GitHub - bscotch/keyboard-layouts: Data related to keyboard layouts and virtual keys, for use in mapping inputs for games.