locale: Optimize guessLCLocale by moving function calls out of loops.