DRY refactor load_language function