I want to be able to translate the overriden labels, changing:

src/Plugin/Field/FieldWidget/InlineEntityFormBase.php @ getEntityTypeLabels (266-284) fixes the issue:

  /**
   * Gets the entity type managed by this handler.
   *
   * @return \Drupal\Core\Entity\EntityTypeInterface
   *   The entity type.
   */
  protected function getEntityTypeLabels() {
    // The admin has specified the exact labels that should be used.
    if ($this->getSetting('override_labels')) {
      return [
        'singular' => $this->t($this->getSetting('label_singular')),
        'plural' => $this->t($this->getSetting('label_plural')),
      ];
    }
    else {
      $this->createInlineFormHandler();
      return $this->inlineFormHandler->getEntityTypeLabels();
    }
  }
CommentFileSizeAuthor
#5 2797215.patch916 bytesandersmosshall

Comments

johndevman created an issue. See original summary.

johnwebdev’s picture

Issue summary: View changes
dawehner’s picture

Status: Active » Needs work

Do you mind providing some patch? This would help the maintainer to see what you changed.

IMHO though you should not run t() through this configuration here. Configuration should always be translated using the config translation module.
For this case here, I think though that we have to adapt the config schema to change away from

    label_singular:
      type: string
      label: "Label (singular)"

to

    label_singular:
      type: label
      label: "Label (singular)"

to make it translatable

cosolom’s picture

Version: 8.x-1.0-alpha6 » 8.x-1.0-rc1

Problem still exists in rc1

andersmosshall’s picture

Status: Needs work » Needs review
StatusFileSize
new916 bytes

Patch with changes from #3

chris matthews’s picture

Version: 8.x-1.0-rc1 » 8.x-1.x-dev
hanness’s picture

Status: Needs review » Reviewed & tested by the community

#5 works for me. As there is no UI, I created a translation file for the view mode and imported it via drush cim.

Btw: there is also a core issue for a view/form mode translation UI: #2546212: Entity view/form mode formatter/widget settings have no translation UI - did not tested it yet.

chris matthews’s picture

oknate’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

#2974544: Convert tests from Simpletest to FunctionalJavascript is in. Can we get test coverage for this?

geek-merlin’s picture

Title: Translate overriden labels » Overriden labels should be translatable
Category: Feature request » Bug report
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs tests

The patch is a fix for a simple config schema oversight. If we test this, we must test an awful lot. So daring to re-RTBC.
Feel free to disagree.

geek-merlin’s picture

Status: Reviewed & tested by the community » Fixed

  • geek-merlin committed c8df492 on 8.x-1.x
    Issue #2797215 by andersmosshall, dawehner, hanness: Overriden labels...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.