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?

1 Answer 1


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. Commented May 17, 2020 at 14:39
  • welcome...... :)
    – Pawan
    Commented May 17, 2020 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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