Make it possible to swap out plugin discovery mechanisms even with translations.

Created on 9 December 2012, over 11 years ago
Updated 16 August 2023, 10 months ago

Problem/Motivation

At the moment you have different ways to define translatable strings in discovery mechanisms.

/**
 * Implements hook_foo_plugins().
 */
  return array(
    'label' => t('Label'),
  );
/**
 * @Plugin(
 *   label = @Translation("Label")
 * )
 */

so if you just want to swap out the discovery mechanism you can't because your code is either using $definition['label'] or just $definition['label']->get().

Proposed resolution

One way to fix it could be to add a __toString() method to the translation class, and require people to cast it, when it's needed,
thought i consider this as bad DX, not sure about the proper way.

πŸ“Œ Task
Status

Postponed: needs info

Version

9.5

Component
PluginΒ  β†’

Last updated about 19 hours ago

Created by

πŸ‡©πŸ‡ͺGermany dawehner

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.

Production build 0.69.0 2024