Add input filter to PluralFormula

Created on 11 October 2018, over 6 years ago
Updated 31 January 2023, about 2 years ago

At the moment PluralFormula doesn't filter or validate the input from a .po file.

If someone accidentally copies the .pot template to a .po file the Plural-Forms will be invalid:

"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

In turn this will cause a bug on the "User interface translation" overview:

Another side-effect will be that PluralFormula::loadFormulae stores the faulty plural definition "INTEGER" in a State variable:

$ drush state-get locale.translation.formulae
array(1) {
 ["locale.translation.formulae"]=>
 array(3) {
   ["nl"]=>
   array(2) {
     ["plurals"]=>
     string(7) "INTEGER"
     ["formula"]=>
     array(1) {
       ["default"]=>
       int(0)
     }
   }

In turn, this results in a bug where plurals no longer work because PluralTranslatableMarkup::getPluralIndex will always return the singular string:

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
LocaleΒ  β†’

Last updated 4 days ago

Created by

πŸ‡§πŸ‡ͺBelgium mpp

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024