I don't know about other compositors, but on Hyprland and Sway you can configure things per device (in the config file). I'd give an example here but I'm on my phone right now.
I have a laptop and a desktop with slightly different keyboard layouts, and both machines share the same config file.
Not sure why you have a tool to "set the language", what would happen if you tried to use both keyboards at once?