protected function StringTranslationTrait::getNumberOfPlurals in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::getNumberOfPlurals()
- 9 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::getNumberOfPlurals()
Returns the number of plurals supported by a given language.
See also
\Drupal\locale\PluralFormulaInterface::getNumberOfPlurals()
2 calls to StringTranslationTrait::getNumberOfPlurals()
- PluralVariants::getSourceElement in core/
modules/ config_translation/ src/ FormElement/ PluralVariants.php - Returns the source element for a given configuration definition.
- PluralVariants::getTranslationElement in core/
modules/ config_translation/ src/ FormElement/ PluralVariants.php - Returns the translation form element for a given configuration definition.
File
- core/
lib/ Drupal/ Core/ StringTranslation/ StringTranslationTrait.php, line 88
Class
- StringTranslationTrait
- Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Namespace
Drupal\Core\StringTranslationCode
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;
}