php - I cannot translate the text in twig files -


i using twig files of forms in php application. did following link

http://twig.sensiolabs.org/doc/extensions/i18n.html#

which tells how twig files can translated using twig_extensions_extension_i18n. believe have followed steps still cannot seem solve problem.

this how php code looks like

require_once 'twig/autoloader.php'; twig_autoloader::register(); $twig_loader = new twig_loader_filesystem(app_path . 'corporate/views'); $globals['twig'] = new twig_environment($twig_loader, array(     'cache' => tmp_path . 'twig_cache',     'debug' => debug,     'auto_reload' => true )); $globals['twig']->addextension(new twig_extensions_extension_i18n());   return $globals['twig']->         render('path/to/twig/template'.$formtemplate,             array_merge($formvariables,                 array(                     "help" => isset($helpbox) ? $helpbox : array(),                     "type" => $current_data['type'],                     "integration_id" => $current_data['action_comp'],                     "automation_type" => $current_data['automation_type']                 )             )         ); 

there php file read twig files , run following command following.

$exe = 'xgettext --force-po --default-domain emarketeer --keyword="pgettext:1c,2" -c -j -o /tmp/messages.po '.escapeshellarg($file).' >/dev/null 2>&1'; system($exe); 

this how twig template ($formtemplate) looks like

{% extends 'integrations/_mixed/automation_form_wrapper.twig' %}

{% block formular %} {% import "_utils/form.twig" form %}

{{ form.boxlabel( 'name (choose automation name)'|trans, "name") }}

{{ form.input("action_name", action_name.value, "", "", action_name.collection ) }}

{% endblock %}

the imported twig template ('_utils/form.twig') form looks

{% macro boxlabel(label, label_for, tooltip, class, extra) %} {% set label_parts = label|split("\n") %} {{- label_parts[0] -}} {% if tooltip %} {% endif %} {% if label_parts[1] %} {{ label_parts[1]}} {% endif %} {% endmacro %} {% macro input(name, value, type, class, extra) %} {% endmacro %}

can please tell me if missing something. there lot of code cannot defin or explain hope have delivered idea , question. appreciated.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -