Update language download during install to use existing folder if present #28425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
For example if you pre-install the language files somewhere else, the install process downloads another copy elsewhere unless you reconfigure your install script.
e.g. The demo builds are currently popping up a status check saying it has two l10n folders.
Before
It ALWAYS creates and downloads the folder.
After
Note there are two steps involved: How to determine the l10n location, and whether to download.
Technical Details
Commit 1 looks messy but is mostly the same as before except that it additionally checks if the folder exists and if it doesn't goes on to the next candidate. The preferred order of how it ends up setting
['civicrm.l10n']
is the same as before though:['civicrm.l10n']
already, that's the first choice.define
or environment variable, that's the second choice.['civicrm.private']
is the third choice.Commit 2 is straightforward if viewed without whitespace. It just now only downloads if the language subfolder doesn't already exist.
Commits 3 and 4 are just extra.
Comments
Some examples:
CIVICRM_L10N_BASEDIR=/path/to/l10n cv core:install --lang=aa_AA ...
will check if/path/to/l10n
in exists, and if it does will use that, and if not will use sites/default/files/civicrm/l10n. Then, if the aa_AA lang is already downloaded in the determined location, it won't download again./path/to/l10n
and you runCIVICRM_L10N_BASEDIR=/path/to/l10n cv core:install --lang=aa_AA ...
. It will use/path/to/l10n
and download another copy there. The existing status check will tell you about it and you can decide what to do.cv core:install --lang=aa_AA ...
. It will use the files you already have in civicrm_root/l10n.