Refactor locale cache building to an external class.