Problem/Motivation

\Drupal\locale\LocaleProjectRepository::buildProjects no longer respects weight since the massive refactor in #3037156: Modernize locale history functions

The example hook documentation

function hook_locale_translation_projects_alter(&$projects) {
  // The translations are located at a custom translation sever.
  $projects['existing_project'] = [
    'info' => [
      'interface translation server pattern' => 'http://example.com/files/translations/%core/%project/%project-%version.%language.po',
    ],
    // An optional key to change the order in which translation files are
    // processed. By default, the projects are sorted alphabetically by key.
    'weight' => 1,
  ];
}

works on 11.3 but not 11.4.x

Steps to reproduce

See #3609008: Fix module on 11.4.x

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3609087

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:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue tags: +Needs tests
alexpott’s picture

Status: Active » Needs review
Issue tags: -Needs tests
nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

This is a straightforward fix, not sure why we dropped it.

Test looks good, I can't run test only changes against core committer pipelines.

I checked all other instances of LocaleTranslatableProject and they should be good, it's just here we create it without the weight.

nicxvan’s picture

I manually pulled this down and ran the test only changes, it fails as expected without the weight set and passes with the fix!

catch made their first commit to this issue’s fork.

  • catch committed 38d6cd53 on main
    fix: #3609087 \Drupal\locale\LocaleProjectRepository::buildProjects()...
catch’s picture

Version: main » 11.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to main, 11.x and 11.4.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 49cf73e0 on 11.4.x
    fix: #3609087 \Drupal\locale\LocaleProjectRepository::buildProjects()...

  • catch committed 94efcafb on 11.x
    fix: #3609087 \Drupal\locale\LocaleProjectRepository::buildProjects()...