Problem/Motivation
I need to disable downloading translations from the server to speed up the installation process.
I use a script php ./scripts/test-site.php install --langcode de to install a minimum profile
For that task we have a special flag download_translation in the function install_state_defaults(), that is FALSE by default.
But, as I see, this flag is never checked in any part of the Drupal Core, and translations are downloaded every time, spending a lot of time on this.
As a result, the installation with non-default language takes too much time (48 sec instead of 4 sec on my local), when I actually don't need to download translations in most cases.
Steps to reproduce
1. Install the minimal Drupal version for tests with language = en:
php ./scripts/test-site.php install --langcode en
See that it takes around 2-5 seconds.
2. Install the minimal Drupal version for tests with language != en, eg with "de":
php ./scripts/test-site.php install --langcode de
See that it takes around 30-80 seconds!
Proposed resolution
Respect the value of the flag download_translation and skip downloading translations if it is false.
And add an option to force enable or disable translation downloading.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3482251
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
murzA fix from me for this is to check the flag value and pass the server_pattern only if the flag 'download_translation' is TRUE, in the file
core/includes/install.core.inc:- see the MR https://git.drupalcode.org/project/drupal/-/merge_requests/9900
After this, the installing time for non-en languages decreased to almost the same as with en language. But still not equal, so seems it still spends time on scanning files or other operations.
Comment #4
murzThis issue causes slow performance of running all tests with non-default language, I reported this as a separate issue: #3482349: drupalInstall Nightwatch command with non-default langcode takes too long time to install
The same issue is true for functional tests using Simpletest and PHPUnit.
Comment #5
murzHere are tests of the Nightwatch drupalInstall() on the 11.x branch:
and with my fixes:
So, at least we got speed up for 5+ times! But still not the same time as with the en language.
The Nightwatch test code to measure on your side:
Comment #6
murzTested on my tests and it works great, so moving to the "Needs review".
Comment #7
smustgrave commentedThanks for reporting,
Seems like an issue that will need test coverage for sure.
Comment #10
rudolfbykerRebased and fixed merge conflicts.
Next up: Write tests.
Comment #11
rudolfbykerI refactored this, and wrote a test, but after seeing the existing tests fail and figuring out why, I realize that the current approach is not going to work. Still investigating and planning a new way to solve this.