- 🇸🇪Sweden edward.peters
I have exactly the same issue. Did you find a solution?
- 🇺🇸United States RichardDavies Portland, Oregon
No, I don't think I did other than to manually translate the view through the native Drupal translation UI.
- 🇸🇪Sweden edward.peters
My developer has written a patch that fixes this. I have asked him to share here, and hopefully someone can get it into the next module release.
- Status changed to Needs review
about 1 year ago 8:01am 6 February 2024 - last update
about 1 year ago 101 pass, 8 fail - 🇮🇳India vinaygawade Sawantwadi, Maharashtra
Here is the patch against 8.x-1.x branch.
The last submitted patch, 6: implode()-error-when-translating-views-with-plural-variants-3306071-6.patch, failed testing. View results →
- 🇺🇸United States davemaxg
I can confirm that using the View result counter - Global field from views also causes this error. I am using 8.x-1.15.
The patch does not apply to this version either. I will look into a new patch if I have some time. - 🇺🇸United States fskreuz
The patch in #6 tried to split the text at the form level, attempting to follow what
config_translation
did (albeit very specific to Views config and not using the\Drupal\Component\Gettext\PoItem::DELIMITER
that's actually used to join the values).But there's another issue: The delimiter separating the strings can also get lost after translation (e.g. Google Translate API via
tmgmt_google
). So while you can check the source text for\Drupal\Component\Gettext\PoItem::DELIMITER
and split it for the source, the translation provider might come back with just one string without the delimiters - not something you can split and map 1:1 with the source with the same amount of textfields/textareas.An alternative solution would be to split the source string to an array and translate the singular and plurals independently. However, the job item data's
#text
property is expected in many places to just be a single string. Switching this to also support an array, or have a different key altogether requires refactoring in many places (many spots in the code specifically look for#text
or#file
).Skipping
plural_label
fields from translation altogether as a workaround will just produce a value ofNULL
, which also causes the same error in the same spot.The workaround is to translate the config with plurals manually via
config_translation
.