Capitalisation of translation tab forced to lowercase

Created on 28 May 2014, about 10 years ago
Updated 12 March 2023, over 1 year ago

Question of the century - What is wrong in this code for sure?

  /**
   * {@inheritdoc}
   */
  public function getTitle() {
    $options = array();
    if (!empty($this->pluginDefinition['title_context'])) {
      $options['context'] = $this->pluginDefinition['title_context'];
    }

    // Take custom 'config_translation_plugin_id' plugin definition key to
    // retrieve title. We need to retrieve a runtime title (as opposed to
    // storing the title on the plugin definition for the link) because
    // it contains translated parts that we need in the runtime language.
    $type_name = Unicode::strtolower($this->mapperManager()->createInstance($this->pluginDefinition['config_translation_plugin_id'])->getTypeLabel());
    return $this->t($this->pluginDefinition['title'], array('@type_name' => $type_name), $options);
  }

Yeah... translatable strings will never changed in capitalization via code. This must be done by the translator and nobody else.

WRONG:

$type_name = Unicode::strtolower($this->mapperManager()->createInstance($this->pluginDefinition['config_translation_plugin_id'])->getTypeLabel());

CORRECT:

$type_name = $this->mapperManager()->createInstance($this->pluginDefinition['config_translation_plugin_id'])->getTypeLabel();

However this is still not the title string configured in google_analytics.config_translation.yml. There is one more bug.

πŸ› Bug report
Status

Closed: duplicate

Version

9.5

Component
Config translationΒ  β†’

Last updated about 1 month ago

Created by

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.

  • πŸ‡³πŸ‡ΏNew Zealand quietone New Zealand

    There is a later issue that for fixing this is more cases. That issue has more discussion of the problem so I am closing this as a duplicate.

Production build 0.69.0 2024