PHP code and blade files

[ad_1]

Plugin Author
Tim W

(@timwhitlock)

Currently, no. The Blade extractor in Loco Translate is a bit of a workaround, and assumes the file is all non-PHP code.

It starts by adding its own <?php tag to the beginning of the stream, and then uses the PHP tokenizer to parse out the function calls. It doesn’t try to switch between PHP and non-PHP as it works through the file. I guess it should, but it doesn’t. I don’t use Blade, so I wasn’t aware this was a problem.

Thank you for your prompt response. I understand what the problem is now, it can be easily bypassed by changing the code to the following

@php
$loco_works = __('Loco Works for this', 'vgstudio');
@endphp
<span class="share__text">
{{ __('and now Loco Works for this to', 'vgstudio') }}</span>

Plugin Author
Tim W

(@timwhitlock)

Great. Saves me some work.

Thanks for posting your solution

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer