protected StringTranslationTrait::getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
See also
\Drupal\locale\PluralFormulaInterface::getNumberOfPlurals()
File
- core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php, line 88
Class
- StringTranslationTrait
- Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Namespace
Drupal\Core\StringTranslation
Code
protected function getNumberOfPlurals($langcode = NULL) {
if (\Drupal::hasService('locale.plural.formula')) {
return \Drupal::service('locale.plural.formula')->getNumberOfPlurals($langcode);
}
// We assume 2 plurals if Locale's services are not available.
return 2;
}
Please login to continue.