code: func (d Deps) ForLanguage(cfg DepsCfg, onCreated func(d *Deps) error) (*Deps, error) {
  	l := cfg.Language
  	var err error
  
  	d.PathSpec, err = helpers.NewPathSpecWithBaseBaseFsProvided(d.Fs, l, d.BaseFs)
  	if err != nil {
  		return nil, err
  	}
  
  	d.ContentSpec, err = helpers.NewContentSpec(l)
  	if err != nil {
  		return nil, err
  	}
  
  	d.Site = cfg.Site
  
  	// The resource cache is global so reuse.
  	// TODO(bep) clean up these inits.
  	resourceCache := d.ResourceSpec.ResourceCache
  	d.ResourceSpec, err = resources.NewSpec(d.PathSpec, d.ResourceSpec.FileCaches, d.Log, cfg.OutputFormats, cfg.MediaTypes)
  	if err != nil {
  		return nil, err
  	}
  	d.ResourceSpec.ResourceCache = resourceCache
  
  	d.Cfg = l
  	d.Language = l
  
  	if onCreated != nil {
  		if err = onCreated(&d); err != nil {
  			return nil, err
  		}
  	}
  
  	if err := d.translationProvider.Clone(&d); err != nil {
  		return nil, err
  	}
  
  	if err := d.templateProvider.Clone(&d); err != nil {
  		return nil, err
  	}
  
  	d.BuildStartListeners = &Listeners{}
  
  	return &d, nil
  
  }
docs: // ForLanguage creates a copy of the Deps with the language dependent
  // parts switched out.