Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SimonAngatia's avatar

Embedding Vue js Variables in PHP tags in blade template

Hello guys, I am trying to implement https://github.com/Stichoza/google-translate-php for translation on my site. Now I have set up everything well and static variables are being translated. However, I have a problem with dynamic variables since they can from vue. So my question is, is there a way I can pass vue variables to PHP tags? Because if that is possible I know how I am going to go around it. This is what I am trying to do which the initialized google translate instance to translate dynamic data from vue, but it is throwing error! I want to translate the dynamic variable from vue spor.detail :)


<span @click="bultenSpor.id == spor.id ? bultenSpor = 'null': bultenSpor = spor; bultenCurrentId = spor.id">
                            <div class="text">
                          <?php   
				$tr = new GoogleTranslate();
				$tr->translate(@{{spor.detail}}, "en") 
			 ?>
                            </div>
                            <div class="sayi">
                                @{{ count(spor) }}
                            </div>
                        </span>
0 likes
1 reply

Please or to participate in this conversation.