When using block title as field label

And the block is a view the title doesn't get translated even when I translated the title of the view

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rodrigoaguilera created an issue. See original summary.

myLies’s picture

Can confirm - when view title are translated - it don't show translated title in block
But, I translated it using block translation

aspilicious’s picture

What happens when you select "use block title as the field label"

aspilicious’s picture

Issue tags: +drupalmountaincamp
bceyssens’s picture

Status: Active » Needs review
FileSize
448 bytes

Status: Needs review » Needs work

The last submitted patch, 5: block_view_title_not_translatable-2835537-5.patch, failed testing.

bceyssens’s picture

Status: Needs work » Needs review
FileSize
609 bytes
swentel’s picture

Status: Needs review » Postponed (maintainer needs more info)

Mmm, using $this->t() seems weird. How does core translate this?

swentel’s picture

Version: 8.x-3.x-dev » 5.0.x-dev
swentel’s picture

Status: Postponed (maintainer needs more info) » Needs work

We should change type_label to 'label' so config translation can kick in.

swentel’s picture

Version: 5.0.x-dev » 8.x-3.x-dev
swentel’s picture

Getting close with this patch. To fix:

- Adding translation acts a bit weird, it overwrites the original initially as well (but does save the translated label)
- getting to use the translated version of the title in the frontend
- clear cache when adding/deleting ds field (to trigger ds_config_translation_info_alter()).

(this would have probably been easier and more logic if our fields were config entities, but oh well)

swentel’s picture

Status: Needs work » Closed (won't fix)

So ironically, if you use the title from the field itself, you can translate via the translate ui - cf DynamicField class. Completely missed that.

Adding t() around the title when it comes from a block or views is not my favorite option here, so simply closing.