I developed a twig plugin (to display graphs from a webform). These plugins contain English texts; And I want the same file to keep translations for several languages by default (for example, Arabic), that is, the end user does not have to translate these texts through the Drupal interface. Currently using:
{%set Hotness_text ={en:'Cold',ar:'ARABIC_TEXT',fa:'PERSIAN_TEXT'}%} {% if language == 'en' %} Hotness Axis is: <strong>{{Hotness_text.en}}</strong> {% elseif language == 'ar' %} ... {% elseif language == 'fa' %} ... {% endif %}
But I want a better way, according to which the translation available in the twig file by Default; and the translation text transferred to the Drupal translation system automatically; So that the user can add any other translation later.