Problem/Motivation
Discovered while working on #2611298: Port potx to Drupal 8
Potx allows users to extract existing translations from the Drupal database into .po (portable object) files. A .po file declares the plural rules for the language, so the correct singular or plural form of a string is displayed when a localized string is evaluated.
Currently in D7, the language plural formula is stored in {languages.formula}, so it can easily be retrieved by querying this table. The plural rule was then evaluated through eval()
In D8, this eval()
was removed in #1273968: remove eval from locale.module in favor of a plural element stack that contains the precalculated plural values. However, the plural formula is now no longer available.
Proposed resolution
Under discussion:
- Store the formula string during translation import; Provide an interface to retrieve the string value.
Remaining tasks
Needs tests.
User interface changes
none
API changes
To be determined.
Data model changes
To be determined.