I lived most of my life in AZERTY countries, but I got used to QWERTY once I started tinkering with Linux, since most Unix software is QWERTY-centric. If you are looking for an adventure, try using vim with a French keyboard.
I can’t remember the details, but I somehow got my hands on an old laptop with a US layout. I spent a few years constantly switching between the two, AZERTY on my desktop and QWERTY on my laptop. It’s impressive how the brain can adapt sometimes.

Fast forward a few years and I discovered that layout variants are common in real life. Apple even provides a dedicated documentation page to find out what your layout is. When starting a new job, I usually ask for a US keyboard, a QWERTY ANSI layout. In my last two jobs, I was provided laptops with a QWERTY layout. Yes but… ISO. Based on the Apple page, they were Dutch and International English keyboards.
When starting a new position, you have a lot more in mind than changing your brand new laptop. So, both times, I kept them and took it upon myself to make it work.

It wasn’t a big deal but for one thing, I write a lot of French, and I need my composable accents. The backtick key is used for the grave accent, which is used a lot, and that key isn’t in the usual place. Unbearable! I even tried not to use accents, but the grammarian in me couldn’t let it pass. It’s impressive how the brain can not adapt sometimes.

Fortunately, macOS uses USB HID specification and even provides a command to remap keys. In the end, I swapped the paragraph key with the backtick key using the following one-liner:

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}'

And for completeness, here is an annotated version of the property value:

{
  "UserKeyMapping": [
    {
      // 0x35 = Keyboard Grave Accent and Tilde
      "HIDKeyboardModifierMappingSrc": 0x700000035,
      "HIDKeyboardModifierMappingDst": 0x700000064
    },
    {
      // 0x64 = Keyboard Non-US \ and |
      "HIDKeyboardModifierMappingSrc": 0x700000064,
      "HIDKeyboardModifierMappingDst": 0x700000035
    }
  ]
}

The change doesn’t survive a reboot, but just for the record, this is the way to roll it back:

hidutil property --set '{"UserKeyMapping":[]}'

I am not interested in making it persistent myself but it’s not that hard, that’s just a plist file to create. I even found an online generator for that when writing this note.

This is the low-level way of doing it, but for more involved setups there is the awesome Karabiner-Elements. And it also handles external keyboards perfectly.