Refactoring the locales controller