Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Is there a way to dinamically translate javascript variables in Symfony?

I have a twig variable with a value like:

{{ var | trans }}

Obviously this is working as intended in the HTML when the page loads, but I need to be able to change the variable's value with javaScript dinamically.

Now, I get that twig is executed on the server-side, but I was wondering if there is some workaround to get this translated using Symfony's translator (or other options).

I have learned that you cannot pass variables from PHP to JS using an external file, which I am using, but still, I am not sure if there is no option whatsoever to achieve what I need. Been searching for a while and I know there are more lookalike questions like this one but no answer responded to this specific question.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!