Problem/Motivation

If an existing module gets replaced by a new version of this module, the new version is not displayed on the translation status page.

Proposed resolution

  • Refresh the data during the module update(.php) process.
  • Refresh the data and remove old translation file during translation update (cron, drush, manual)

Remaining tasks

t.b.d.

User interface changes

bug is fixed

API changes

none

Data model changes

none

CommentFileSizeAuthor
#43 interdiff-38-43.txt845 bytesmstrelan
#43 2575945-43.patch8.86 KBmstrelan
#38 2575945-38.patch8.8 KBranjith_kumar_k_u
#35 patch_apply.png57.22 KBvikashsoni
#34 drupal-locale-update-version-2575945-34.patch8.85 KBtobiasb
#31 drupal-locale-update-version-2575945-31.patch8.85 KBtobiasb
#29 drupal-locale-update-version-2575945-29.patch8.85 KBSutharsan
#29 interdiff-2575945-26-29.txt754 bytesSutharsan
#26 drupal-locale-update-version-2575945-25.patch8.84 KBSutharsan
#26 interdiff-2575945-23-25.txt1.6 KBSutharsan
#23 drupal-locale-update-version-2575945-23.patch8.89 KBSutharsan
#23 interdiff-2575945-21-23.txt1.49 KBSutharsan
#21 drupal-locale-update-version-2575945-21.patch17.86 KBSutharsan
#21 interdiff-2575945-20-21.txt667 bytesSutharsan
#20 drupal-locale-update-version-2575945-20.patch8.94 KBSutharsan
#16 drupal-locale-update-version-2575945-16.patch8.93 KBSutharsan
#16 interdiff-2575945-13-16.txt6.72 KBSutharsan
#13 drupal-locale-update-version-2575945-13.patch2.36 KBSutharsan
#9 drupal-locale-update-version-2575945-9.patch2.51 KBSutharsan
#2 locale-update-version-2575945-2.patch401 bytesSutharsan

Issue fork drupal-2575945

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sutharsan created an issue. See original summary.

Sutharsan’s picture

A simple fix. This clears the 'last updated date' too, perhaps that is not a good idea.

Sutharsan’s picture

Status: Active » Needs review

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sutharsan’s picture

I have found a new approach, more subtle one. It clears the translation status and removes the translation file(s) when a change in version is detected.

Status: Needs review » Needs work

The last submitted patch, 9: drupal-locale-update-version-2575945-9.patch, failed testing. View results

Sutharsan’s picture

Issue summary: View changes

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sutharsan’s picture

Version: 8.6.x-dev » 8.8.x-dev
Status: Needs work » Needs review
FileSize
2.36 KB

Re-rolled the #9 patch against 8.8.x before working on it.

Status: Needs review » Needs work

The last submitted patch, 13: drupal-locale-update-version-2575945-13.patch, failed testing. View results

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Sutharsan’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
6.72 KB
8.93 KB

Test added that checks the new functionality: checks if project version changes; deletes the old translation file; downloads the new translation.

Existing test fixed and documented.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Sutharsan’s picture

Sutharsan’s picture

Removed the unused type hint that caused a spelling check error.

Status: Needs review » Needs work

The last submitted patch, 21: drupal-locale-update-version-2575945-21.patch, failed testing. View results

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
1.49 KB
8.89 KB

A few compatibility changes in test scripts.

andypost’s picture

  1. +++ b/core/modules/locale/locale.batch.inc
    @@ -20,6 +20,43 @@
    +function locale_translation_batch_version_check($project, $langcode, &$context) {
    
    +++ b/core/modules/locale/locale.compare.inc
    @@ -268,7 +268,8 @@ function _locale_translation_batch_status_operations($projects, $langcodes, $opt
    +      $operations[] = ['locale_translation_batch_version_check', [$project, $langcode]];
    

    I bet it needs type-hints for the function arguments

    Moreover I'd better created separate class for new function in context on "Kill includes" tag but I sure there's follow-up already for that

  2. +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationChangeProjectVersionTest.php
    @@ -0,0 +1,87 @@
    +    $moduleHandler = $this->container->get('module_handler');
    +    $moduleHandler->loadInclude('locale', 'inc', 'locale.batch');
    ...
    +    \Drupal::state()->set('locale.test_projects_alter', TRUE);
    +    \Drupal::state()->set('locale.remove_core_project', TRUE);
    

    I'm sure $this->container should be replaced with \Drupal::moduleHandler()

Sutharsan’s picture

Status: Needs work » Needs review

Both comments in #24 addressed in this patch.

I did not find an issue for converting any of the functions in this batch.inc. I did find some individual issue to convert the procedural functions to a decent API. I think it is time for a new initiative to move locale module up the OO ladder. It's been procedural for too long.

Sutharsan’s picture

Sutharsan’s picture

andypost’s picture

Status: Needs review » Needs work

Thank you a lot for #27!

The last $project, $langcodeboth needs string type-hint as they available since PHP 7.0

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
754 bytes
8.85 KB

Thanks for the quick review.
This patch addresses the #28 comments.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks ready

tobiasb’s picture

Removed typehint of $context in locale_translation_batch_version_check.

 diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc
-index fcc284618f..43b3476f67 100644
+index fcc284618f..94ace67938 100644
 --- a/core/modules/locale/locale.batch.inc
 +++ b/core/modules/locale/locale.batch.inc
 @@ -20,6 +20,43 @@
@@ -20,7 +20,7 @@
 + * @param array|\ArrayAccess $context
 + *   The batch context.
 + */
-+function locale_translation_batch_version_check(string $project, string $langcode, array &$context) {
++function locale_translation_batch_version_check(string $project, string $langcode, &$context) {
 +  $locale_project = \Drupal::service('locale.project')->get($project);
 +
 +  if (empty($locale_project)) {

phpDoc allows \ArrayAccess and drush use this. ;-)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 31: drupal-locale-update-version-2575945-31.patch, failed testing. View results

tobiasb’s picture

Status: Needs work » Needs review
tobiasb’s picture

vikashsoni’s picture

FileSize
57.22 KB

Patch is working fine and applied cleanly ....

Thanks

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ranjith_kumar_k_u’s picture

Rerolled #34 for 9.5

Status: Needs review » Needs work

The last submitted patch, 38: 2575945-38.patch, failed testing. View results

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ericdsd’s picture

Hi i have the same issue with drush locale:update that doesn't replace contrib module .po file by new version when module is updated even after a locale:update locale:check.

Experiencing it on drupal 9.4.8

ericdsd’s picture

Hi patch #38 works against 9.5.2

tested with both config remote_and_local and Local
it works nicely, the only strange thing is that the conts of updated strings slihtly differs on each test i did event while using the same database as start point.

When rexproting the sites po for comparison, everything looks fine, i only have 2 extra string when i'm in remote_and_local mode as those strings are displayed during remote locale:check.

with same database :
remote+local
> [notice] Translations imported: 847 added, 13712 updated, 0 removed.
local (with po commited from first test)
> [notice] Translations imported: 848 added, 13468 updated, 0 removed.

mstrelan’s picture

Came here from a related issue in Bug Smash. Have updated the patch in #38 to fix the test fail / deprecation. Also since we can have union types now I've reverted #31 and added a union type.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

LocaleTranslationChangeProjectVersionTest - Error : Call to undefined function Drupal\Tests\locale\Functional\locale_translation_batch_version_check()

testUpdateCron -
Queue holds tasks for one project.
Failed asserting that 2 matches expected 3.
Expected :3
Actual :2

Made sure the tests fail without the fix and they do.
Reviewing the code changes look good.

Question for committer if locale_translation_batch_version_check needs a change record.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 43: 2575945-43.patch, failed testing. View results

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Ammaletu’s picture

I would be interested in getting this finished and merged. This might not be the worst bug that Drupal has to offer, but it still breaks a pretty basic core functionality. Right now, people are upgrading to Drupal 10.1 and will be wondering why all kinds of simple and visible Strings are not translated.

I just added the patch #43 to our Drupal 10.1.6 installation. It applied without a problem and cured the problem with the missing translations of newer Strings. The new test LocaleTranslationChangeProjectVersionTest.php runs successfully, as does the changed test LocaleUpdateCronTest.

I'm not sure about Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest that apparently failed back in May, see #45. Our project still uses CKEditor 4, but I tried it on an unmodified Drupal 10.1 installation. Everything worked there, but all test methods in the MediaTest were skipped.

So what is actually mssing here? I tried to trigger a restest of patch #43. When this hopefully succeeds, can we simply set this back RTBC?

Ammaletu’s picture

Status: Needs work » Needs review

In the meantime, I had a second look and understood that I need to install a Chromium driver so that the JavaScript tests are not simply skipped. With ddev-selenium-standalone-chrome installed, they are now executed. In my local test setup of a fresh Drupal 10.2-dev installation, JSWebAssertTest works with the patch installed as does MediaTest.

Can somebody with a better understanding of how Drupal's test setup works please have a look at what might be missing here or if we can set this back to RTBC? I'm setting this back to "Needs review" for now.

Also, comment #44 raised the question "if locale_translation_batch_version_check needs a change record". I'm not sure about that -- do we need a change record just because there is a new function? But I think fixing the bug might warrant a change record, as people might rely on the old translations or have lots of missing translations added themselves.

needs-review-queue-bot’s picture

Status: Needs review » Needs work

The Needs Review Queue Bot tested this issue.

While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

mstrelan’s picture

JavaScript tests tend to have random fails. I've converted to a merge request rather than rerunning the failing job since it's a lot quicker. Let's see if it comes back green.

mstrelan’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

MR is showing green, believe #43 was a random failure.

Thanks @mstrelan for hiding all patches.

  • larowlan committed 7bd4aaca on 10.2.x
    Issue #2575945 by Sutharsan, mstrelan, tobiasb, ranjith_kumar_k_u,...

  • larowlan committed 9e290d8c on 11.x
    Issue #2575945 by Sutharsan, mstrelan, tobiasb, ranjith_kumar_k_u,...
larowlan’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to 11.x

Backported to 10.2.x

Nice work folks, great to get this long-standing issue solved 🐛🔨

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.