Theory of optical polarization due to electron capture from localized target states by fast ions