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

Created on 9 December 2012, over 12 years ago
Updated 16 August 2023, almost 2 years 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 2 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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This seems like something that could still be valid.

    But could you confirm please?

  • Status changed to Closed: outdated about 1 month ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    There has been no work on this task for 12 year except to ask if this is still needed.. It is likely that it is no longer needed or has been implemented. Therefor, closing.

    If there is work to do here, then either re-open the issue and add a comment or open a new issue and reference this one.

Production build 0.71.5 2024