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?


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

  • Thanks, that worked. May 17 '20 at 14:39
  • welcome...... :)
    – Pawan
    May 17 '20 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.