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.