Fix crash in (some) custom keyboards

Not all custom keyboard define the country code, which is normally
needed as the basis for the keyboard code.  For those keyboards, the
language code is used instead.