diff --git a/core/includes/install.inc b/core/includes/install.inc index 4c9c60c273c72c861123202f41754d757ee86aa5..f0c329b268a3cf5a3eda84a1a324c8ec4205ef11 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -700,6 +700,9 @@ 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 e304451314bd150e866734d492c20418d63ce4d0..11c53613546b9efe941123282c4bd44dd4ef8213 100644 --- a/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php +++ b/core/lib/Drupal/Component/Gettext/PoMemoryWriter.php @@ -34,11 +34,12 @@ function __construct() { * 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(); } /**