Theory of the isotope shift for zero-phonon optical transitions at traps in semiconductors