Fix language availability checking

The typeof operator returns a string: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof