diff --git a/core/includes/install.inc b/core/includes/install.inc index 4c9c60c..3d72ba4 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -700,6 +700,10 @@ function st($string, array $args = array(), array $options = array()) { // that multiple files end with the same extension, even if unlikely. $files = install_find_translation_files($install_state['parameters']['langcode']); if (!empty($files)) { + // Register locale classes with the classloader. + // Locale module is not yet enabled at this stage, + // so this is not happening automatically. + drupal_classloader_register('locale', drupal_get_path('module', 'locale')); $strings = Gettext::filesToArray($install_state['parameters']['langcode'], $files); } } diff --git a/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php b/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php index e304451..11c5361 100644 --- a/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php +++ b/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php @@ -34,11 +34,12 @@ class PoMemoryWriter implements PoWriterInterface { * Implements Drupal\Component\Gettext\PoWriterInterface::writeItem(). */ public function writeItem(PoItem $item) { - if (is_array($item->source)) { - $item->source = implode(LOCALE_PLURAL_DELIMITER, $item->source); - $item->translation = implode(LOCALE_PLURAL_DELIMITER, $item->translation); + if (is_array($item->getSource())) { + $item->setSource(implode(LOCALE_PLURAL_DELIMITER, $item->getSource())); + $item->setTranslation(implode(LOCALE_PLURAL_DELIMITER, $item->getTranslation())); } - $this->_items[isset($item->context) ? $item->context : ''][$item->source] = $item->translation; + $context = $item->getContext(); + $this->_items[$context != NULL ? $context : ''][$item->getSource()] = $item->getTranslation(); } /** diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index 8a9c2fe..069de2e 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -141,8 +141,8 @@ function locale_translate_import_form_submit($form, &$form_state) { drupal_set_message(t('The translation import of %filename is done.', $variables)); watchdog('locale', 'The translation import of %filename is done.', $variables); - } catch (Exception $exc) { - drupal_set_message(print_r($exc, TRUE)); + } + catch (Exception $exception) { $variables = array('%filename' => $file->filename); drupal_set_message(t('The translation import of %filename failed.', $variables), 'error'); watchdog('locale', 'The translation import of %filename failed.', $variables, WATCHDOG_ERROR); @@ -412,7 +412,8 @@ function locale_translate_batch_import($filepath, &$context) { locale_translate_update_file_history($file); $context['results']['files'][$filepath] = $filepath; $context['results']['stats'][$filepath] = $report; - } catch (Exception $exception) { + } + catch (Exception $exception) { $context['results']['files'][$filepath] = $filepath; $context['results']['failed_files'][$filepath] = $filepath; }