Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Translation causes 500 #13693

Open
1 task done
EsdersGmbH opened this issue Apr 25, 2024 · 5 comments
Open
1 task done

Missing Translation causes 500 #13693

EsdersGmbH opened this issue Apr 25, 2024 · 5 comments
Labels
bug Issues or PR's relating to bugs forms Anything related to forms good first issue pending-feedback PR's and issues that are awaiting feedback from the author T1 Low difficulty to fix (issue) or test (PR) twig

Comments

@EsdersGmbH
Copy link

EsdersGmbH commented Apr 25, 2024

Mautic Version

5.0.x series

Way of installing

I downloaded a release from https://www.mautic.org/mautic-releases

PHP version

8.1.2

What browsers are you seeing the problem on?

Not relevant

What happened?

Currently this bug happens in the form builder of mautic. Every time I open it on certain forms, I get a 500 because of some missing translations. I would expect, that mautic either uses an fallback for translations or simply don't throw a 500. Because I can't edit this form right now. As from the logs it seems, that there is also an issue with the submission count on some forms.

How can we reproduce this issue?

Here comes the problem, this only occurs on some Forms not on all and as I mentioned it seems it has something to do with the submission count being 0? But the form has already some submissions.

Relevant log output

[2024-04-25 07:50:24] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "{1}Show after 1 submission|[2,Inf] Show after %count% submissions" with locale "en_US" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at C:\var\www\mautic\app\bundles\FormBundle\Resources\views\Builder\_field_wrapper.html.twig line 86 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"{1}Show after 1 submission|[2,Inf] Show after %count% submissions\" with locale \"en_US\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at C:\\var\\www\\mautic\\app\\bundles\\FormBundle\\Resources\\views\\Builder\\_field_wrapper.html.twig:86, Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"{1}Show after 1 submission|[2,Inf] Show after %count% submissions\" with locale \"en_US\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at C:\\var\\www\\mautic\\vendor\\symfony\\translation-contracts\\TranslatorTrait.php:129)

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct




Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.

@EsdersGmbH EsdersGmbH added bug Issues or PR's relating to bugs needs-triage For new issues/PRs that need to be triaged labels Apr 25, 2024
@RCheesley RCheesley added forms Anything related to forms twig and removed needs-triage For new issues/PRs that need to be triaged labels Apr 29, 2024
@RCheesley
Copy link
Sponsor Member

Thanks for reporting the bug @EsdersGmbH - unfortunately I am struggling to reproduce it. Can you please provide a screencast to show this in action?

Have you also tried to delete the downloaded language pack and get it again?

@RCheesley RCheesley added the pending-feedback PR's and issues that are awaiting feedback from the author label Apr 29, 2024
@luk4s
Copy link

luk4s commented Apr 30, 2024

Hi,
I have same issue in my instance:

during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":21}
[2024-04-30T17:05:05.240036+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":33}
[2024-04-30T17:05:56.794672+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":21}

I use mautic/mautic:5-apache image (7f58863a5bcc). It raise when try to open segment detail. Edit works, but detail didn't. I try it on empty segment also on segment with several contacts.

I have 7 segments and 2 of them did not show details (raise exception), rest works fine....

Let me know if I can provide more details.

@EsdersGmbH
Copy link
Author

@RCheesley I've update the language, but the issue still remains. These is unfortunately not on all forms only on some. I have made a screen recording. My system language is in German, but in English I get the same issue too.

mautic-bug.mp4

@parohac4
Copy link

Hi, I have same issue in my instance:

during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":21}
[2024-04-30T17:05:05.240036+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":33}
[2024-04-30T17:05:56.794672+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/html/docroot/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/html/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"ca7838b95774","pid":21}

I use mautic/mautic:5-apache image (7f58863a5bcc). It raise when try to open segment detail. Edit works, but detail didn't. I try it on empty segment also on segment with several contacts.

I have 7 segments and 2 of them did not show details (raise exception), rest works fine....

Let me know if I can provide more details.

Hello,

I have the same error. As soon as I switch the user's language to ENG, I open the segment detail. When the user language is set to CZ, some segments don't open.

[2024-05-22T10:08:01.723623+00:00] mautic.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Unable to choose a translation for "one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund" with locale "cs" for value "0". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples").")." at /var/www/XXXXX/app/bundles/LeadBundle/Resources/views/List/details.html.twig line 71 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\").\"). at /var/www/XXXXX/app/bundles/LeadBundle/Resources/views/List/details.html.twig:71)\n[previous exception] [object] (Symfony\\Component\\Translation\\Exception\\InvalidArgumentException(code: 0): Unable to choose a translation for \"one: %count% sekunda|[2,4]: %count% sekundy|[5,Inf]: %count% sekund\" with locale \"cs\" for value \"0\". Double check that this translation has the correct plural options (e.g. \"There is one apple|There are %count% apples\"). at /var/www/XXXXX/vendor/symfony/translation-contracts/TranslatorTrait.php:125)"} {"hostname":"mautic-prod","pid":423014}

Mautic version 5.04, PHP 8.0.30.

@RCheesley RCheesley added good first issue T1 Low difficulty to fix (issue) or test (PR) labels May 28, 2024
@RCheesley
Copy link
Sponsor Member

Thanks folks, it seems like it's something to do with the Twig layouts, I've added it to the Open Source Friday todo list and hopefully we'll be able to get someone to have a look at it soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs forms Anything related to forms good first issue pending-feedback PR's and issues that are awaiting feedback from the author T1 Low difficulty to fix (issue) or test (PR) twig
Projects
Status: 🤔 To Do
Development

No branches or pull requests

4 participants