Problem/Motivation
PluralVariants::setConfig() joins the variant fields with PoItem::DELIMITER. When all the fields are empty, it saves only the delimiters as the translation. The form reports "Successfully saved Languagename translation." The translated plural then shows an empty text for every number.
The interface translation form deletes a translation when all its variants are empty, so it can fall back on the original string. With an empty string having only the delimiters the config translation can't fall back on the source.
#3529265: Plural .po import saves as delimiters-only when the translations are empty instead of not saving anything reports the same delimiter problem for .po imports for interface translation.
Steps to reproduce
- Install with Standard. Enable Configuration Translation.
- Add Slovenian, core will import translations and set the 4 plural forms.
- Go to
admin/structure/views/view/files/translate/sl/add. - Empty the four plural variant fields of the "Used in" field. Save.
- The
language.sloverride ofviews.view.fileshas"\x03\x03\x03"indisplay.default.display_options.fields.count.format_plural_string.
Proposed resolution
When all the variants are empty, PluralVariants::setConfig() should remove this string from the override. The source value then will show up, same as the interface translation form deleting the translation for thatone string.
LLM disclosure
Generated with the help of an LLM.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot 2026-10-25 at 06.28.59.png | 362.85 KB | gábor hojtsy |
| #6 | Screenshot 2026-10-25 at 06.26.26.png | 240.97 KB | gábor hojtsy |
| #6 | Screenshot 2026-10-25 at 06.25.36.png | 249.11 KB | gábor hojtsy |
Issue fork drupal-3632104
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
gábor hojtsyComment #4
gábor hojtsyI believe this is complete and ready for review. Now includes a post update with tests that has an empty plural translation with other translations and another empty plural standalone in a file (so the whole file will be gone too).
Comment #5
smustgrave commented@gabor I tried to replicate following the steps but I'm not seeing those values. Could you flush out the steps to reproduce more please.
Comment #6
gábor hojtsyI had no issue reproducing it again on drupalforge on a fresh site. This is the initial view of the config translation form on this view. This is the only one single view in core that uses for plural I believe btw:
I emptied it out and loaded this form back in, now it has the empty fields as loaded from config:
I exported a full config dump with Configuration Manager and looked at this override file from my VSCode. This key should be missing as I just emptied it out but it is there as binary:
That said poking around more, it is true that when emptying a regular non-plural string, config translation also stores that as an empty string (which locale considers a customized translation and also stores as an empty string for shipped strings).
Given that I think this needs more thinking as to how this should behave, especially how it relates to synching with locale's db, importing from .po and saving to config translation, etc.
Comment #7
gábor hojtsyThat also means that #3529265: Plural .po import saves as delimiters-only when the translations are empty instead of not saving anything needs to be postponed on the same grounds as the two go hand in hand for shipped config at least.