drush locale check Deletes Specific .po Files and Replaces with General .po Files

Created on 20 June 2024, 8 days ago
Updated 21 June 2024, 7 days ago

Problem/Motivation

When running the drush locale:check command on our Drupal site, we have encountered a recurring issue where existing .po files are deleted and replaced with more general .po files if a specific .po file for a module or core version is not found. For example, we are currently running Drupal core version 10.2.7 and have a drupal-10.2.6-de.po file. When drush locale:check is executed, this file gets deleted and replaced with a drupal-10.x-de.po file.

Steps to reproduce (only until a new 10.2.7 .po file is available)

Steps to Reproduce
Use Drupal core version 10.2.7.
Place a specific .po file (e.g., drupal-10.2.6-de.po) in the translations directory.
Run the command drush locale:check.
Observe that the specific .po file is deleted and replaced by a more general drupal-10.x-de.po file.

Expected Behavior
The drush locale:check command should check for and update translations without deleting existing .po files that are specific to the current Drupal core version or modules.

Actual Behavior
The drush locale:check command deletes existing version-specific .po files if they are not matched and replaces them with more general .po files. This causes a loss of specific translations that were manually added.

Impact
This behavior is problematic as it leads to the loss of detailed and specific translations. It also introduces additional manual steps to ensure translations are correctly reapplied after running drush locale:check.

Possible Workarounds
Manually download and place the necessary .po files after running drush locale:check.
Use scripts to ensure the presence of specific .po files and prevent their deletion.

Suggested Solution
Enhance the drush locale:check functionality to preserve existing .po files and avoid replacing them with general files unless explicitly instructed. Alternatively, implement a more intelligent matching mechanism that respects version-specific files and only updates when a correct replacement is found.

πŸ› Bug report
Status

Active

Version

10.2 ✨

Component
LocaleΒ  β†’

Last updated 3 days ago

Created by

πŸ‡©πŸ‡ͺGermany macdev_drupal Wiesbaden

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @macdev_drupal
  • Status changed to Postponed: needs info 8 days ago
  • πŸ‡ΊπŸ‡ΈUnited States cilefen

    locale:check entirely in Drush and this bug may not be fix-able in Drupal Core. I think you may have to report this to Drush.

  • Status changed to Active 7 days ago
  • πŸ‡©πŸ‡ͺGermany macdev_drupal Wiesbaden

    Drush hands over to the local module. So I think this should be addressed there.
    Just checked
    web/core/modules/locale/locale.fetch.inc
    web/core/modules/locale/locale.batch.inc
    the methods there are just triggered from drush locale:check and the business logic is in those methods.
    Maybe there could be a fall back, before deleting / renaming .po files locally.

  • πŸ‡ΊπŸ‡ΈUnited States cilefen
Production build 0.69.0 2024