Extract the existing code for temporarily changing the global locale into a reusable class. No real changes.