Safely parse locale