How can I make certain fields of my block implementation translatable?

vn flag

I've created a simple module, which extends BlockBase to provide a custom block.

This block class has a few fields (e.g., "Header"), which I would like to be translatable.

How can I accomplish this? The Drupal docs have a section titled "Make your block translatable", but it hasn't actually been written yet.

I've found some posts which suggest that my module needs a .schema.yml file – but I'm not clear on exactly how that works, or if it's even correct.

I'm running Drupal 9.3.x.


4uk4 avatar
cn flag
Yes, a good example is in the [Examples]( module. See also

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.