How to change keyboard layout with a keyboard shortcut in OSX

To study Japanese I added to my Mac some extra keyboard layouts. However when I was reviewing my Anki cards I found annoying every time to have to press on the little flag icon and chose the appropriate layout. On OSX (El Captain, but I guess is the same on older ones), you can add a shortcut which I set to ‚Ć•Space to avoid conflicting with Spotlight.