This will ensure that valid locales are tested. As an added bonus, the code is greatly simplified. Will-fix: #9897