Skip to content
Snippets Groups Projects
Commit d3d71807 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #3016471 by Gábor Hojtsy, drumm, tedbow: Make localization file download...

Issue #3016471 by Gábor Hojtsy, drumm, tedbow: Make localization file download major version agnostic
parent 6f73a35a
No related branches found
No related tags found
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards
......@@ -1939,7 +1939,7 @@ function install_check_translations($langcode, $server_pattern) {
$variables = [
'%project' => 'drupal',
'%version' => $version,
'%core' => \Drupal::CORE_COMPATIBILITY,
'%core' => 'all',
'%language' => $langcode,
];
$translation_url = strtr($server_pattern, $variables);
......
......@@ -69,7 +69,7 @@ function locale_translation_build_projects() {
$data += [
'name' => $name,
'version' => isset($data['info']['version']) ? $data['info']['version'] : '',
'core' => \Drupal::CORE_COMPATIBILITY,
'core' => 'all',
// A project can provide the path and filename pattern to download the
// gettext file. Use the default if not.
'server_pattern' => isset($data['info']['interface translation server pattern']) && $data['info']['interface translation server pattern'] ? $data['info']['interface translation server pattern'] : $default_server['pattern'],
......
......@@ -328,3 +328,10 @@ function locale_update_8500() {
->save();
}
}
/**
* Clear Locale project storage to use new 'all' instead of 8.x in URLs.
*/
function locale_update_8800() {
\Drupal::service('locale.project')->deleteAll();
}
......@@ -49,7 +49,7 @@ public function testUpdateImportSourceRemote() {
], $this->translationsStream);
$url = \Drupal::service('url_generator')->generateFromRoute('<front>', [], ['absolute' => TRUE]);
$uri = $url . PublicStream::basePath() . '/remote/8.x/contrib_module_one/contrib_module_one-8.x-1.1.de._po';
$uri = $url . PublicStream::basePath() . '/remote/all/contrib_module_one/contrib_module_one-8.x-1.1.de._po';
$source_file = (object) [
'uri' => $uri,
];
......
......@@ -194,9 +194,9 @@ protected function setTranslationFiles() {
// Add a number of files to the local file system to serve as remote
// translation server and match the project definitions set in
// locale_test_locale_translation_projects_alter().
$this->makePoFile('remote/8.x/contrib_module_one', 'contrib_module_one-8.x-1.1.de._po', $this->timestampNew, $translations_one);
$this->makePoFile('remote/8.x/contrib_module_two', 'contrib_module_two-8.x-2.0-beta4.de._po', $this->timestampOld, $translations_two);
$this->makePoFile('remote/8.x/contrib_module_three', 'contrib_module_three-8.x-1.0.de._po', $this->timestampOld, $translations_three);
$this->makePoFile('remote/all/contrib_module_one', 'contrib_module_one-8.x-1.1.de._po', $this->timestampNew, $translations_one);
$this->makePoFile('remote/all/contrib_module_two', 'contrib_module_two-8.x-2.0-beta4.de._po', $this->timestampOld, $translations_two);
$this->makePoFile('remote/all/contrib_module_three', 'contrib_module_three-8.x-1.0.de._po', $this->timestampOld, $translations_three);
// Add a number of files to the local file system to serve as local
// translation files and match the project definitions set in
......
......@@ -36,10 +36,10 @@ public function testBuildProjects() {
// Confirm the project name and core value before the module is altered.
$projects = locale_translation_build_projects();
$this->assertSame('locale_test', $projects['locale_test']->name);
$this->assertSame('8.x', $projects['locale_test']->core);
$this->assertSame('all', $projects['locale_test']->core);
$projects['locale_test']->langcode = 'de';
$this->assertSame('/8.x/locale_test/locale_test-1.2.de.po', locale_translation_build_server_pattern($projects['locale_test'], '/%core/%project/%project-%version.%language.po'));
$this->assertSame('/all/locale_test/locale_test-1.2.de.po', locale_translation_build_server_pattern($projects['locale_test'], '/%core/%project/%project-%version.%language.po'));
// Alter both the name and core value of the project.
\Drupal::state()->set('locale.test_system_info_alter_name_core', TRUE);
......@@ -55,10 +55,10 @@ public function testBuildProjects() {
// Confirm the name and core value are not changed in the project.
$projects = locale_translation_build_projects();
$this->assertSame('locale_test', $projects['locale_test']->name);
$this->assertSame('8.x', $projects['locale_test']->core);
$this->assertSame('all', $projects['locale_test']->core);
$projects['locale_test']->langcode = 'de';
$this->assertSame('/8.x/locale_test/locale_test-1.2.de.po', locale_translation_build_server_pattern($projects['locale_test'], '/%core/%project/%project-%version.%language.po'));
$this->assertSame('/all/locale_test/locale_test-1.2.de.po', locale_translation_build_server_pattern($projects['locale_test'], '/%core/%project/%project-%version.%language.po'));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment