No translation updates for current version of project

Created on 4 April 2020, over 4 years ago
Updated 30 January 2023, almost 2 years ago

The version of a project is saved when you first import the translation. When you later check for updated translations, Drupal will only check for updates for the original version of the project - not the current version.

Since projects don't introduce many news strings after the first stable release, it's hard to discover that this is going on. However, in my case Drupal was fetching updates for 8.5.5 when I had updated to 8.9.0-beta2 - entries in the main menu was still untranslated.

Steps to reproduce

  1. Download Drupal 8.9.0-beta2 using Composer and drupal/recommended-project.
  2. Install with wanted locale and enable Devel 2.1
  3. drush si standard --locale=nb --db-url=[...]
    composer require drupal/devel:^2.0
    drush pm:enable devel
  4. Go to admin/config/regional/translate/settings and select "Local files only" so we have full control
  5. Then update to Devel 3.0-beta1 and clear cache so Drupal has pick it up
    composer require drupal/devel:^3.0
    drush cr
  6. Create translation for 3.0-beta1 and make sure it has the highest timestamp.
    cp web/sites/default/files/translations/devel-8.x-2.1.nb.po web/sites/default/files/translations/devel-8.x-3.0-beta1.po
    touch -t "05020600" web/sites/default/files/translations/devel-8.x-2.1.nb.po
    touch -t "05030600" web/sites/default/files/translations/devel-8.x-3.0-beta1.po
    
  7. Go to admin/reports/translations and see that the update is "Devel (2020-05-02)" in stead of "Devel (2020-05-03)"

There are many other ways to reproduce the problem. However, if the translation timestamp for old and new version is the same (on localize.drupal.org), you have to play with timestamps - either on the file systems (as above) or in the database.

Solution sketch

When checking for updates, check if the current version of the project has changed. If so, use existing code to update translations status. To avoid duplicated code some refactoring is necessary.

Add tests that check that the updated translation for the new release is used.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
LocaleΒ  β†’

Last updated 5 days ago

Created by

πŸ‡³πŸ‡΄Norway hansfn

Live updates comments and jobs are added and updated live.
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.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.71.5 2024