Make custom keyboard layout switch by Caps Lock
Switching the keyboard layout using CapsLock is a feature added to MacOS 10.12 in 2016.  It does not seem to be very well documented by Apple–which should not come as a surprise to anyone who's been using their products for very long.  I haven't managed to find any 'developer-level' documentation of this function at all.

So, basically, to answer your question: In order to switch from one language/layout to another using CapsLock you must create a custom keyboard layout which combines both layouts.  I believe that Ukelele would be the easiest way to accomplish this.

However, be aware that this is work-around that comes close to duplicating the original feature although there are some minor discrepancies which for me personally are actually preferable to the way the original feature was designed to work–although your preferences &amp; priorities may obviously vary.  While your work-around using Karabiner more closely emulates the original feature which makes my option somewhat redundant and potentially inferior.  But it has some advantages in my opinion so I've decided to post it.

In any case, in order to use my work-around you must create a single custom keyboard layout based on the US keyboard that also has the appropriate foreign language/writing system layout programmed directly into the CapsLock-based modifier combinations (keyboard layers or shift levels–such as Caps+Shift, Caps+Option &amp; etc.). Mac OSX essentially treats CapsLock as a regular, but locking, modifier key without any limitations. So, with Ukelele you may create a layout which supports multiple scripts and uses CapsLock to switch between them.

The Latin-based modifier combinations can mostly (if not entirely) be created automatically in several ways (the easiest being to duplicate the US keyboard you use, or create a layout that mirrors the currently active layout).

For the secondary script layers you can open a keyboard for that language you wish to emulate (or approximate) and drag the key mappings from that keyboard to you yours (with the proper CapsLock-based modifier combination activated).

I don't think that a little bit of manual labor can be avoided, but you can accomplish your objective natively in this way. There are some potential advantages &amp; disadvantages to this option depending on your preferences. For example, the flag will not change from US to another flag which may be seen as a disadvantage although that is irrelevant to me personally. However, you will have the CapsLock LED as an indicator which is visible on the keyboard itself which may be seen as an advantage. This also circumvents having to change the keyboard layout which is sometimes necessary when switching apps or documents, as well as the slight delay involved with that–that is of particular value to me as it drives me crazy when the keyboard layout is potentially different in each app.

Since you've already got a solution working this probably won't be of particular use, however, perhaps another user may find this solution helpful or informative.