Question

I'm running a multi website and store setup. I'm trying to use inline translation within a CMS block so I don't have to create multiple blocks for different stores.

For example I'm using this within a CMS block to enable inline translation.

<h1 class="hero-h1"><?php echo __('Welcome to this website') ?></h1>

However it doesn't appear on the page, when I inspect element it shows as

<h1 class="hero-h1"><!--?php echo __('Welcome to this website') ?--></h1>

Is there anyway text can be inline translated in a CMS Block?

Was it helpful?

Solution

php translate will not work in static block

you need to add like:

<h1 class="hero-h1">{{trans "Welcome to this website" }}</h1>

You can add translation as per link

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top