allow setting of the locales dynamically

In a multisite setup I need to set the locale setup dynamically based on changeable data of each site (they have different language requirements). To be able to do this, I need a method to set the locale preferences.