php - Translation filter inside a twig {% raw %} block -


i have html template containing handlebarsjs code include in page render product popups. problem templates bit complex , i'd need translate labels on them too, there way notify exception twig parser? that, though code inside raw block rendered anyway? if use translation tag doesn't work {{ 'translations.project.template.price'|trans }}

eg: index.html.twig:

{{ include('webbundle:frontend:partials/templates/product-template.html.twig') }} 

product-template.html.twig:

{% trans_default_domain "home" %} {% raw %}   {{#if islovepromo}}     <div class="product-infotag promo">       promozione <!-- here text i'd translate -->     </div>   {{/if}} {% endraw %} 

at moment i'm working aroun passing translations object rendered handlebars have this:

index.html.twig:

data.translations = {   promo: "{{ 'translations.project.template.promotion'|trans }}" } 

template.render(data); product-template.html.twig:

... <div class="product-infotag promo">   {{ promo }}  </div> ... 

this method works it's overkill, have templates in have pass more 12 strings , looks not efficient me way.

is there way of addressing directly in twig?


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -