Problem/Motivation

Surfaced by @alexpott while reviewing #3398982: ConfigFormBase + validation constraints: support non-1:1 form element-to-config property mapping again — it'd have been out of scope there.

Convert

/**
 * UI option for override of existing translations. Override any translation.
 */
const LOCALE_TRANSLATION_OVERWRITE_ALL = 'all';

/**
 * UI option for override of existing translations.
 *
 * Only override non-customized translations.
 */
const LOCALE_TRANSLATION_OVERWRITE_NON_CUSTOMIZED = 'non_customized';

/**
 * UI option for override of existing translations.
 *
 * Don't override existing translations.
 */
const LOCALE_TRANSLATION_OVERWRITE_NONE = 'none';

to a backed enum.

(These were introduced by #1804688: Download and import interface translations over a decade ago, when enums were a distant dream 😄.)

Steps to reproduce

N/A

Proposed resolution

Convert to backed enum.

Remaining tasks

  • Add backed enum.
  • Deprecate the old constants
  • Reviews

User interface changes

None.

API changes

Deprecate the 3 constants.

Data model changes

None.

Release notes snippet

None.

Issue fork drupal-3401493

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

Wim Leers created an issue. See original summary.

wim leers’s picture

wim leers’s picture

Issue summary: View changes
Status: Active » Needs review
wim leers’s picture

Issue summary: View changes

wim leers’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Actually, I think @alexpott also meant to refactor

…
translation:
…
  overwrite_customized: false
  overwrite_not_customized: true
…

in locale.settings.yaml to use this enum instead.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.