Dynamical effective charges in semiconductors: A pseudopotential approach