Loading core/includes/install.core.inc +3 −2 Original line number Diff line number Diff line Loading @@ -1792,8 +1792,9 @@ function _install_prepare_import($langcodes, $server_pattern) { if (is_object($file)) { $filename = $file->filename; preg_match('/drupal-([0-9a-z\.-]+)\.' . $langcode . '\.po/', $filename, $matches); // Get the version information. if ($version = $matches[1]) { // Get the version information. Custom translation files may not have a // version number. if (isset($matches[1]) && $version = $matches[1]) { $info = _install_get_version_info($version); // Picking the first file does not necessarily result in the right file. So // we check if at least the major version number is available. Loading core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php 0 → 100644 +41 −0 Original line number Diff line number Diff line <?php namespace Drupal\FunctionalTests\Installer; use Drupal\Tests\BrowserTestBase; /** * Tests non-standard named translation files get imported during install. * * @group Installer */ class InstallerTranslationNonStandardFilenamesTest extends InstallerTranslationMultipleLanguageNonInteractiveTest { /** * {@inheritdoc} */ protected function prepareEnvironment() { BrowserTestBase::prepareEnvironment(); // Place custom local translations in the translations directory. mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.de.po', $this->getPo('de')); file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.es.po', $this->getPo('es')); } /** * {@inheritdoc} */ protected function prepareSettings() { parent::prepareSettings(); $settings['config']['locale.settings']['translation']['default_filename'] = (object) [ 'value' => '%project.%language.po', 'required' => TRUE, ]; $settings['config']['locale.settings']['translation']['default_server_pattern'] = (object) [ 'value' => 'translations://%project.%language.po', 'required' => TRUE, ]; $this->writeSettings($settings); } } Loading
core/includes/install.core.inc +3 −2 Original line number Diff line number Diff line Loading @@ -1792,8 +1792,9 @@ function _install_prepare_import($langcodes, $server_pattern) { if (is_object($file)) { $filename = $file->filename; preg_match('/drupal-([0-9a-z\.-]+)\.' . $langcode . '\.po/', $filename, $matches); // Get the version information. if ($version = $matches[1]) { // Get the version information. Custom translation files may not have a // version number. if (isset($matches[1]) && $version = $matches[1]) { $info = _install_get_version_info($version); // Picking the first file does not necessarily result in the right file. So // we check if at least the major version number is available. Loading
core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationNonStandardFilenamesTest.php 0 → 100644 +41 −0 Original line number Diff line number Diff line <?php namespace Drupal\FunctionalTests\Installer; use Drupal\Tests\BrowserTestBase; /** * Tests non-standard named translation files get imported during install. * * @group Installer */ class InstallerTranslationNonStandardFilenamesTest extends InstallerTranslationMultipleLanguageNonInteractiveTest { /** * {@inheritdoc} */ protected function prepareEnvironment() { BrowserTestBase::prepareEnvironment(); // Place custom local translations in the translations directory. mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.de.po', $this->getPo('de')); file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal.es.po', $this->getPo('es')); } /** * {@inheritdoc} */ protected function prepareSettings() { parent::prepareSettings(); $settings['config']['locale.settings']['translation']['default_filename'] = (object) [ 'value' => '%project.%language.po', 'required' => TRUE, ]; $settings['config']['locale.settings']['translation']['default_server_pattern'] = (object) [ 'value' => 'translations://%project.%language.po', 'required' => TRUE, ]; $this->writeSettings($settings); } }