Impossible to skip interface translations download on Drupal install

Created on 6 April 2020, over 4 years ago
Updated 7 July 2024, 3 months ago

Problem/Motivation

When installing from existing config, interface translations are always downloaded and imported, regardless of locale's translation.use_source config.

The download of drupal PO files happens in install_check_translations():

if ($translations_directory_exists && $readable && $writable && $translation_available) {
  $translation_downloaded = install_retrieve_file($translation_url, $translations_directory);

  if (!$translation_downloaded) {
    $requirements['translation downloaded'] = [
      'title'       => t('Translation'),
      'value'       => t('The %language translation could not be downloaded.', ['%language' => $language]),
      'severity'    => REQUIREMENT_ERROR,
      'description' => t('The %language translation file could not be downloaded. <a href=":url">Choose a different language</a> or select English and translate your website later.', ['%language' => $language, ':url' => $_SERVER['SCRIPT_NAME']]),
    ];
  }
}

Shouldn't there be an extra check for locale_translation_use_remote_source()?
My understanding is that if we set locale's config: translation.use_source: local, then Drupal should not try to fetch PO files from the server.
Is this a bug or intended behavior?

Proposed resolution

Possibly by adding an extra check for locale_translation_use_remote_source() in install_check_translations()

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Installย  โ†’

Last updated 4 days ago

No maintainer
Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium herved

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request โ†’ as a guide.

    As a bug this will need a test case to show the issue.

    Thanks!

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand xurizaemon ลŒtepoti, Aotearoa ๐Ÿ

    Moving to 11.x - I think this is worth progressing. Downloading translations (or attempting to download translations which don't exist) can slow pipelines unnecessarily, as @heddn notes above

    The patch as-is appears to work as intended. If locale.settings/translation.use_source = local, installing with --existing-config will skip attempting to download translations.

    The UI configuration screen for that is at /admin/config/regional/translate/settings (Interface translation settings / Translation source).

    Patch from #3 applies as of 10.1.4.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    Tested the issue with 10.3.1 and seems like the config: $config['locale.settings']['translation']['use_source'] = 'local'; affects only contrib modules, the core translations are still downloaded from the FTP server. So the issue seems to be, when having a core in language that has no translation available.

Production build 0.71.5 2024