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
1 2 3 4 5 6 7 | 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.