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

mautic.ERROR: InvalidArgumentException: Unable to choose a translation #8716

Closed
directpromo opened this issue Apr 22, 2020 · 23 comments
Closed
Labels
bug Issues or PR's relating to bugs pending-feedback PR's and issues that are awaiting feedback from the author translations Anything related to translations

Comments

@directpromo
Copy link

directpromo commented Apr 22, 2020

Bug Description

On the page https://domain.com/s/contacts or https://domain.com/s/emails and others with a pager I see an error instead of pager:

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.
System administrators, check server logs for errors.
N8J2q8a

I have moderator rights in https://www.transifex.com/mautic/mautic Deleting erroneous translation lines in Russian does not help, because the lines still remain in the translation files. When I delete folders with language files it is downloaded again with lines that cause an error

Q A
Mautic version 2.16.2
PHP version 7.2

Steps to reproduce

  1. In the settings, set the translation to Russian.
  2. Clear app/console cachecache:clear
  3. app/console translation: update
  4. go to page https://domain.com/s/contacts

Log errors

[2020-04-23 01:17:10] mautic.ERROR: InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "650". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /vendor/symfony/translation/MessageSelector.php - at line 81 [] []

@directpromo
Copy link
Author

the same bug #8730

@pospelov-v
Copy link

+1

I have the same problem. The language is also Russian. The version of the mautic is also 2.16.2. Tell me, please, how to fix it?

@RCheesley RCheesley added bug Issues or PR's relating to bugs translations Anything related to translations labels Apr 27, 2020
@directpromo
Copy link
Author

directpromo commented Apr 27, 2020

to @pospelov-v

I have the same problem. The language is also Russian. The version of the mautic is also 2.16.2. Tell me, please, how to fix it?

In addition to this error, you may encounter some actions in campaigns that are not working (bug #8719), so it's better to cancel the Russian language in the settings for now by clearing the cache.

In Russian:
Кроме этой ошибки вы можете столкнуться с неработоспособностью некоторых действий в кампаниях (баг #8719 ), поэтому лучше пока отказаться от русского языка в настройках, очистив кеш.

@mautibot
Copy link

This issue has been mentioned on Mautic Community Forums. There might be relevant details there:

https://forum.mautic.org/t/problem-with-the-russian-language/14263/2

@RCheesley
Copy link
Sponsor Member

Do we know if this is an issue with the translation itself, or a bug within Mautic? @directpromo have you got any insights you could share?

@directpromo
Copy link
Author

directpromo commented May 11, 2020

@RCheesley

Do we know if this is an issue with the translation itself, or a bug within Mautic? @directpromo have you got any insights you could share?

I am not a programmer, unfortunately.

I tried to solve the problem by deleting the translation lines causing the error from the translation files. It helped.

Then I deleted these lines in translation at https://www.transifex.com/mautic/mautic/. It does not help. Since the translation files are downloaded again from https://www.transifex.com/mautic/mautic/ and the deleted lines reappear, the same error occurs

The translation strings themselves, in my opinion, do not contain errors - they are correctly composed, it is strange that a bug appears.
Maybe it's in the code. Maybe an experienced programmer will be able to see.

@RCheesley
Copy link
Sponsor Member

Cross posting:

when I looked at transifex I noticed that we have some warnings on the translations.

screenshot-www transifex com-2020 05 16-16_25_49

screenshot-www transifex com-2020 05 16-16_26_40

While I don't speak Russian it looks like these warnings might relate to the errors that you are seeing above.

Perhaps this is something that the translation team need to address.

@directpromo
Copy link
Author

see answer in #8719 (comment)

@directpromo
Copy link
Author

No translation errors

2020-05-25_21-48

@directpromo
Copy link
Author

directpromo commented May 25, 2020

@RCheesley How to manage translations in order to prevent errors in translation into Mautic?

@directpromo
Copy link
Author

@RCheesley
I also see that 2 versions of one language have been created - this is superfluous! What for? Russian language is one - it can not be more.

2020-05-25_21-53

If for some reason you want to translate to "ru_RU" instead of "ru", then how to copy all the translations? Who can do it?

@RCheesley
Copy link
Sponsor Member

Hi there, as we are only providing fixes for Mautic 3.x going forward, can you confirm if this continues in Mautic 3.0.1?
Thanks!

@RCheesley RCheesley added pending-feedback PR's and issues that are awaiting feedback from the author triage-mautic-3 labels Jul 1, 2020
@directpromo
Copy link
Author

It remains to wait for the stable version 3.x

@RCheesley
Copy link
Sponsor Member

Please test on mautibox.com - should be possible to test!

@npracht
Copy link
Member

npracht commented Sep 4, 2020

Hi, without any feedback we cannot carry this issue open anymore. I'll close it and in case a new comment justify to re-open it, I'll be glad to do it :)

@npracht npracht closed this as completed Sep 4, 2020
@helirexi
Copy link

hi, just test with Russian lang enabled in Admin as default locale.
Tested here:
https://mautibox.com/staging/s/contacts/fields
I choose latest 3.1.0 (git staging branch) in mautibox instance
was not add any custom field because after switch locale to Russian this error appear:

Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "87". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). /vendor/symfony/translation/MessageSelector.php:89

and below from logs I think:

click to show full error here

`/vendor/symfony/translation/MessageSelector.php:89 at /vendor/symfony/translation/Formatter/MessageFormatter.php:46 at Symfony\Component\Translation\MessageSelector -> choose ( 'один: %count% элемент| несколько: %count% элементов', '87', 'ru' ) /vendor/symfony/translation/Translator.php:226 at Symfony\Component\Translation\Formatter\MessageFormatter -> choiceFormat ( 'один: %count% элемент| несколько: %count% элементов', '87', 'ru', array('%count%' => '87') ) /vendor/symfony/translation/LoggingTranslator.php:58 at Symfony\Component\Translation\Translator -> transChoice ( 'mautic.core.pagination.items', '87', array('%count%' => '87'), 'messages', 'ru' ) /vendor/symfony/translation/DataCollectorTranslator.php:61 at Symfony\Component\Translation\LoggingTranslator -> transChoice ( 'mautic.core.pagination.items', '87', array('%count%' => '87'), 'messages', null ) /vendor/symfony/framework-bundle/Templating/Helper/TranslatorHelper.php:42 at Symfony\Component\Translation\DataCollectorTranslator -> transChoice ( 'mautic.core.pagination.items', '87', array('%count%' => '87'), 'messages', null ) /app/bundles/CoreBundle/Views/Helper/pagination.html.php:194 at Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper -> transChoice ( 'mautic.core.pagination.items', '87', array('%count%' => '87') ) /app/bundles/CoreBundle/Templating/Engine/PhpEngine.php:156 at require ( '/var/app/current/code/pulls/staging/app/bundles/CoreBundle/Views/Helper/pagination.html.php' ) /vendor/symfony/templating/PhpEngine.php:78 at Mautic\CoreBundle\Templating\Engine\PhpEngine -> evaluate ( null, array('app' => object(GlobalVariables), 'totalItems' => '87', 'page' => '0', 'limit' => '30', 'baseUrl' => '/staging/s/contacts/fields', 'sessionVar' => 'leadfield', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticCoreBundle:Helper:pagination.html.php', 'view' => object(PhpEngine)) ) /app/bundles/CoreBundle/Templating/Engine/PhpEngine.php:128 at Symfony\Component\Templating\PhpEngine -> render ( 'MauticCoreBundle:Helper:pagination.html.php', array('app' => object(GlobalVariables), 'totalItems' => '87', 'page' => '0', 'limit' => '30', 'baseUrl' => '/staging/s/contacts/fields', 'sessionVar' => 'leadfield', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticCoreBundle:Helper:pagination.html.php') ) /app/bundles/LeadBundle/Views/Field/list.html.php:130 at Mautic\CoreBundle\Templating\Engine\PhpEngine -> render ( 'MauticCoreBundle:Helper:pagination.html.php', array('totalItems' => '87', 'page' => '0', 'limit' => '30', 'baseUrl' => '/staging/s/contacts/fields', 'sessionVar' => 'leadfield', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticCoreBundle:Helper:pagination.html.php') ) /app/bundles/CoreBundle/Templating/Engine/PhpEngine.php:156 at require ( '/var/app/current/code/pulls/staging/app/bundles/LeadBundle/Views/Field/list.html.php' ) /vendor/symfony/templating/PhpEngine.php:78 at Mautic\CoreBundle\Templating\Engine\PhpEngine -> evaluate ( null, array('app' => object(GlobalVariables), 'items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticLeadBundle:Field:list.html.php', 'view' => object(PhpEngine)) ) /app/bundles/CoreBundle/Templating/Engine/PhpEngine.php:128 at Symfony\Component\Templating\PhpEngine -> render ( 'MauticLeadBundle:Field:list.html.php', array('app' => object(GlobalVariables), 'items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticLeadBundle:Field:list.html.php') ) /vendor/symfony/templating/DelegatingEngine.php:41 at Mautic\CoreBundle\Templating\Engine\PhpEngine -> render ( 'MauticLeadBundle:Field:list.html.php', array('items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield', 'mauticTemplate' => 'MauticLeadBundle:Field:list.html.php') ) /vendor/symfony/framework-bundle/Controller/ControllerTrait.php:262 at Symfony\Component\Templating\DelegatingEngine -> render ( 'MauticLeadBundle:Field:list.html.php', array('items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield') ) /app/bundles/CoreBundle/Controller/CommonController.php:381 at Symfony\Bundle\FrameworkBundle\Controller\Controller -> renderView ( 'MauticLeadBundle:Field:list.html.php', array('items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield') ) /app/bundles/CoreBundle/Controller/CommonController.php:214 at Mautic\CoreBundle\Controller\CommonController -> ajaxAction ( array('viewParameters' => array('items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield'), 'contentTemplate' => 'MauticLeadBundle:Field:list.html.php', 'passthroughVars' => array('activeLink' => '#mautic_contactfield_index', 'route' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield')) ) /app/bundles/LeadBundle/Controller/FieldController.php:109 at Mautic\CoreBundle\Controller\CommonController -> delegateView ( array('viewParameters' => array('items' => object(Paginator), 'searchValue' => '', 'permissions' => array('lead:fields:view' => true, 'lead:fields:full' => true), 'tmpl' => 'index', 'totalItems' => '87', 'limit' => '30', 'page' => '0', 'currentRoute' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield'), 'contentTemplate' => 'MauticLeadBundle:Field:list.html.php', 'passthroughVars' => array('activeLink' => '#mautic_contactfield_index', 'route' => '/staging/s/contacts/fields', 'mauticContent' => 'leadfield')) ) /vendor/symfony/http-kernel/HttpKernel.php:151 at Mautic\LeadBundle\Controller\FieldController -> indexAction ( '0' ) /vendor/symfony/http-kernel/HttpKernel.php:68 at Symfony\Component\HttpKernel\HttpKernel -> handleRaw ( object(Request), '1' ) /vendor/symfony/http-kernel/Kernel.php:200 at Symfony\Component\HttpKernel\HttpKernel -> handle ( object(Request), '1', true ) /app/AppKernel.php:104 at Symfony\Component\HttpKernel\Kernel -> handle ( object(Request), '1', true ) /app/middlewares/CORSMiddleware.php:91 at AppKernel -> handle ( object(Request), '1', true ) /app/middlewares/CatchExceptionMiddleware.php:43 at Mautic\Middleware\CORSMiddleware -> handle ( object(Request), '1', true ) /app/middlewares/Dev/IpRestrictMiddleware.php:64 at Mautic\Middleware\CatchExceptionMiddleware -> handle ( object(Request), '1', true ) /app/middlewares/VersionCheckMiddleware.php:67 at Mautic\Middleware\Dev\IpRestrictMiddleware -> handle ( object(Request), '1', true ) /app/middlewares/TrustMiddleware.php:51 at Mautic\Middleware\VersionCheckMiddleware -> handle ( object(Request), '1', true ) /vendor/stack/builder/src/Stack/StackedHttpKernel.php:23 at Mautic\Middleware\TrustMiddleware -> handle ( object(Request), '1', true ) /vendor/stack/run/src/Stack/run.php:13 at Stack\StackedHttpKernel -> handle ( object(Request) ) /index_dev.php:25 at Stack\run ( object(StackedHttpKernel) ) /index.php:6 at require_once ( '/var/app/current/code/pulls/staging/index_dev.php' )`

@helirexi
Copy link

In my own instance - fresh installed 3.0.1 and upgraded to 3.1.0 without any errors.
Can confirm same error when switch to Russian locale in admin settings (for my account)
This time I start create custom fields for Contacts, labeled them in Russian, save - all look good.
After notice this message in page bottom:
The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator. System administrators, check server logs for errors.

in my /var/logs/mautic_prod-2020-09-14.php:

click here to open details

``` [2020-09-14 16:38:20] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "45". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:42:59] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "46". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:45:41] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "47". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:47:08] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "47". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:50:02] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "47". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:50:30] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "47". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] [] [2020-09-14 16:50:47] mautic.ERROR: Symfony\Component\Translation\Exception\InvalidArgumentException: Unable to choose a translation for "один: %count% элемент| несколько: %count% элементов" with locale "ru" for value "47". Double check that this translation has the correct plural options (e.g. "There is one apple|There are %count% apples"). - in file /var/www/html/vendor/symfony/translation/MessageSelector.php - at line 89 [] []

</p></details>

@helirexi
Copy link

Hi, without any feedback we cannot carry this issue open anymore. I'll close it and in case a new comment justify to re-open it, I'll be glad to do it :)

@npracht please can you open it again?

@zaharovrd
Copy link

@npracht also in v 3.1.1

@helirexi
Copy link

@npracht please reopen this issue - russian (ru) lang have this bug in 3.1.x versions.

@zaharovrd
Copy link

i fix it in translifex

@helirexi
Copy link

i fix it in translifex

so now this fixed and translations can be upload to "../translations/ru/" dir? I was try delete this dir, apply settings in Admin, Default System Language to Russian but mautic won't download it again. Was try set lang to Ukrainian - uk_UA translations was downloaded just fine.
cache was cleared every time. still no luck.

@directpromo
Copy link
Author

directpromo commented Nov 18, 2020

i fix it in translifex

to @zaharovrd

Fixes made in Translifex do not remove the error

Are you sure you checked?
deleted the "../translations/ru/" directory, loaded the translation, the translation lines are translated as in Translifex and no errors occur?
.....
russian:
Роман, исправления в Translifex не помогали.

Вы точно проверили?
т.е. удалили каталог "../translations/ru/", затем сменили в настройках язык для загрузки перевода, посмотрели загрузился ли перевод, проверили, что в переводе строки переведены как в Translifex по новому и, при этом, ошибок не возникает?

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 pending-feedback PR's and issues that are awaiting feedback from the author translations Anything related to translations
Projects
None yet
Development

No branches or pull requests

7 participants