/**
  * Gets translation from locale storage.
  *
  * @param $config_name
  *   Configuration object.
  * @param $key
  *   Translation configuration field key.
  * @param $langcode
  *   String language code to load translation.
  *
  * @return bool|mixed
  *   Returns translation if exists, FALSE otherwise.
  */
 protected function getTranslation($config_name, $key, $langcode)
 {
     $settings_locations = $this->localeStorage->getLocations(array('type' => 'configuration', 'name' => $config_name));
     $this->assertTrue(!empty($settings_locations), format_string('Configuration locations found for %config_name.', array('%config_name' => $config_name)));
     if (!empty($settings_locations)) {
         $source = $this->container->get('config.factory')->get($config_name)->get($key);
         $source_string = $this->localeStorage->findString(array('source' => $source, 'type' => 'configuration'));
         $this->assertTrue(!empty($source_string), format_string('Found string for %config_name.%key.', array('%config_name' => $config_name, '%key' => $key)));
         if (!empty($source_string)) {
             $conditions = array('lid' => $source_string->lid, 'language' => $langcode);
             $translations = $this->localeStorage->getTranslations($conditions + array('translated' => TRUE));
             return reset($translations);
         }
     }
     return FALSE;
 }
 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, array &$form_state)
 {
     $form_values = $form_state['values']['config_names'];
     // For the form submission handling, use the raw data.
     $config_factory = $this->configFactory();
     $old_state = $config_factory->getOverrideState();
     $config_factory->setOverrideState(FALSE);
     foreach ($this->mapper->getConfigNames() as $name) {
         // Set configuration values based on form submission and source values.
         $base_config = $config_factory->get($name);
         $config_translation = $this->languageManager->getLanguageConfigOverride($this->language->id, $name);
         $locations = $this->localeStorage->getLocations(array('type' => 'configuration', 'name' => $name));
         $this->setConfig($this->language, $base_config, $config_translation, $form_values[$name], !empty($locations));
         // If no overrides, delete language specific configuration file.
         $saved_config = $config_translation->get();
         if (empty($saved_config)) {
             $config_translation->delete();
         } else {
             $config_translation->save();
         }
     }
     $config_factory->setOverrideState($old_state);
     $form_state['redirect_route'] = array('route_name' => $this->mapper->getOverviewRoute(), 'route_parameters' => $this->mapper->getOverviewRouteParameters());
 }