Problem/Motivation

There are some procedural callbacks that can be deprecated and moved:

  • locale_system_set_config_langcodes
  • locale_system_update
  • locale_system_remove
  • locale_form_language_admin_add_form_alter_submit
  • locale_form_language_admin_edit_form_alter_submit

Steps to reproduce

Open locale.module

Proposed resolution

Deprecate and move to the appropriate location.
Move locale_system_update and locale_system_remove to protected methods on new LocaleExtensionHooks which contain hooks related to installing and uninstalling extensions.
Move locale_form_language_admin_add_form_alter_submit and locale_form_language_admin_edit_form_alter_submit to public methods on new LocaleFormHooks which contain form related hooks.
locale_system_set_config_langcodes already has a replacement in \Drupal::service('locale.config_manager')->updateDefaultConfigLangcodes()

Remaining tasks

Review

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3595084

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

nicxvan created an issue. See original summary.

nicxvan’s picture

Issue summary: View changes

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
Status: Active » Needs review

This should be ready for review.

I deprecated the 4 functions only used in hooks. I split out the two files related to these new methods.
I also deprecated the function that already has a full replacement.

locale_js_translate is also only used on a hook, but this starting to get larger so I'm not sure if it's appropriate to add here too.

nicxvan’s picture

berdir’s picture

Status: Needs review » Needs work

locale_js_translate() will then also involve several underscored functions, +1 to a separate issue for that.

great work on the hook class split, much nicer than the always slightly awkward than knowingly not injecting those dependencies.

nicxvan’s picture

Status: Needs work » Needs review
berdir’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me, like that we remove one of the locale system functions completely by registering the same method for two hooks, the other has different arguments, but at least it has a sane name now and is protected.

catch’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

One locale.module hunk didn't apply but it was for a change that's already been made in HEAD.

Committed/pushed to main, thanks! There are more conflicts against 11.x so we'll need a backport MR for that.

  • catch committed 47e42d18 on main
    task: #3595084 Deprecate locale submit callbacks
    
    By: nicxvan
    By: berdir
    

nicxvan’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

The only conflict was the FormHooks include in locale.module thanks!

  • catch committed 9ee713e2 on 11.x
    task: #3595084 Deprecate locale submit callbacks
    
    By: nicxvan
    By: berdir
    
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.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.