Avoid javascript error in getIM method

check whether the given language has input methods
Correct Malayalam Avagraha
If language not changed, set IM and exit early

If language not changed, check for input method change.
If input method changed, set it and return.

Avoid unnecessary input method listing