We analyze the relationship between the tendency to electron localization, which is observed in many quasicrystals and approximants, and the local atomic order. Starting from the structural models, we consider atomic clusters that are embedded in a metallic medium, and we study their scattering properties within the multiple-scattering formalism. We show that these local environments can lead to virtual bound states for electrons, i.e., resonances of the wave function in clusters of different length scale. That is consistent with the tendency to localization shown by transport measurements or band-structure calculations. In agreement with the Hume-Rothery picture of quasicrystals, this tendency to localization has a small effect on the total energy.