Mac: swich language with caps-lock

Karabiner-Elements script to:
Switch “en” <-> “he” language using CapsLock.
Shift-CapsLock -> CapsLock

"rules": [
{
    "description": "caps_lock switch en <-> he (grebulon)",
    "manipulators": [
        {
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "mandatory": [
                        "shift"
                    ],
                    "optional": [
                        "caps_lock"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "caps_lock"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "en"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "select_input_source": {
                        "language": "he"
                    }
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "he"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],
            "from": {
                "key_code": "caps_lock",
                "modifiers": {
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "select_input_source": {
                        "language": "en"
                    }
                }
            ],
            "type": "basic"
        }
    ]
}
]