I have Symfony 4.4 application with localization on different languages translations/*.yml.
For example in translations/messages.en.yml
site:
name: My site
So in my twig templates, I can use
{{ 'site.name'|trans }}
I started to use Vue js for my front (with WebBack and Symfony Encore). I know that Vue js has its own internationalization in JSON format. But I don't want to duplicate my translation twice...
Question
Is it possible use Symfony translations in some way in Vue JS?
Something like that...
<template>
<h2>My Vue template</h2>
{{ 'site.name|trans }}
</template>
Question2
Is it possible to use x variable inside of vue template ?
/**
* @Route("", name="homepage")
*
* @return Response
*/
function homepage()
{
return $this->render(
'index.html.twig', [
'x' => 'test',
]
);
}
Vue template
<template>
<h2>My Vue template</h2>
{{ x }}
</template>
Appreciate any advice