Open cheplv opened 8 years ago
Thanks!
We should handle this. PRs are welcome. :)
Added new PR.
There was one more thing: transchoice function
Wow! Great. Tested: it solved the issue for me. thx
But note, that this construct does not seem to be recognized (not converted from Twig to PHP):
Submitted by %author_name% on %date%|trans({'%author_name%': author_name, '%date%': date})
Also this fails too:
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
with
Twig_Error_Syntax: A message inside a trans tag must be a simple text
While it should not.
But this:
{% trans with {'%author_name%': author_name, '%date%': date} %}
works
There was changes in twig relating translation, this cause me open this ticket :) More info: http://symfony.com/doc/current/translation.html Need to make investigation on this generated code: Submitted by %author_name% on %date%|trans({'%author_name%': author_name, '%date%': date})
Are you sure this is Twig specific and not Symfony specfic? Because you linked Symfony documentation.
Due to changes of twig translations method in generated PHP templates - need to add correct keyword. Current translation string looks like: $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->getTranslator()->trans("Greeting.", array(), "messages");
I'v solved this with changing language parameter with keyword parameter. Command looks like: twig-gettext-extractor --sort-output --force-po -o messages.pot --keyword="trans" --files
cat /tmp/tempfile