properly handle locales with country codes

fixes #2890