More refactoring for locale support