Spain striker David Villa has announced he plans to retire from international football after the World Cup.