Problem/Motivation

When exporting translations through the user interface at /admin/config/regional/translate/export, the resulting file contains a hardcoded plural form in the header:

"Plural-Forms: nplurals=2; plural=(n > 1);\n"

The number of plurals and the associated plural formula is different per language. As a result, any Drupal site that imports the resulting .po file will display incorrect translations for plural strings.

Proposed resolution

Update the PoHeader with the correct nplurals and plural formula based on PluralFormulaInterface::getNumberOfPlurals() and PluralFormulaInterface::getFormula()

Since PluralFormulaInterface::getFormula() currently does not return a formula, this is postponed on #2882617: String version of plural formula is not available, exported .po files contain an incorrect default

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

Drupal sites that have imported a .po file with the incorrect plural formula will display the correct plural strings after it imports a correct .po file

API changes

To be determined.

Data model changes

To be determined.

Comments

idebr created an issue. See original summary.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

penyaskito’s picture

Status: Postponed » Closed (duplicate)
Related issues: +#2918489: Plurals are not exported correctly when exporting source translations

This is duplicated of #2918489: Plurals are not exported correctly when exporting source translations. Closing this in favor of that one that already has a patch.