Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda