Optimal switching problems with an infinite set of modes: An approach by randomization and constrained backward SDEs