Fix error when there is no locale defined

It checks if language code is not defined and use default values in that case.