locale: Move the string processing out of the loop.