HHH-8491 Improved implementation for locale string parsing
HHH-8491 formatting and improved readability