Shortcut letter assignments change with keyboard layout change

I have an ergo keyboard that uses Dvorak layout, and sends Dvorak keystrokes, so for instance when I press 'R' on the keyboard, the keyboard sends 'P', as it should. This means that I use the macOS US keyboard layout, because I don't want the keystrokes to be re-translated.

When using my laptop keyboard, I use the macOS Dvorak layout, so when I press 'R' on the keyboard, macOS translates that to 'P', as it should.

The problem arises when using the laptop keyboard with the Dvorak layout. A hot key that should be triggered by, say, ⌃⌥⇧⌘L has been switched to ⌃⌥⇧⌘N.
This seems to be because the US keyboard letter L is the Dvorak keyboard letter N (so the mapping stays with the same scan code, perhaps), but for Dvorak users, L is typed by pressing the key with P printed on it.

Is there a way to keep the shortcuts mapped to the same letter when switching keyboard layouts?

For the curious:
Dvorak (again, I have a laptop keyboard, but the letter layout is the same)

Qwerty

Have you tried the Dvorak - QWERTY ⌘ layout?

46%20AM

I don't use Dvorak myself, but my understanding is that this particular version reverts to the QWERTY layout when using modifier keys, so it may be worth trying to see if it keeps shortcut keys consistent between layouts.

Hot keys (as defined by the system APIs) are based on key codes not key caps, so changing between keyboard layouts does not change the key of the hot key.

Thanks for the suggestion.
A lot of my shortcuts don't use the command key, so this wouldn't work across the board.

Is there a solution?

A solution where your hot keys move when the layout changes? No. The only option would be to have different triggers and/or different macros and enable/disable them.

You could have sets of macro groups with different hot keys, each executing a common macro in a third macro group, and toggle the enables on the macro groups back and forth.

Or perhaps you could have some sort of AppleScript which changes your macro triggers back and forth.

But there is no support for it in Keyboard Maestro. Hot Keys are based on key codes, and key codes pay no attention keyboard layout.