WP_Translations::translate_plural()
Translates a plural string.
Метод класса: WP_Translations{}
Хуков нет.
Возвращает
Строку|null
. Translation if it exists, or the unchanged singular string.
Использование
$WP_Translations = new WP_Translations(); $WP_Translations->translate_plural( $singular, $plural, $count, $context );
- $singular(строка|null) (обязательный)
- Singular string.
- $plural(строка|null) (обязательный)
- Plural string.
- $count(int|float)
- Count. Should be an integer, but some plugins pass floats.
По умолчанию: 1 - $context(строка|null)
- Context.
По умолчанию: ''
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Translations::translate_plural() WP Translations::translate plural WP 6.6.2
public function translate_plural( $singular, $plural, $count = 1, $context = '' ) { if ( null === $singular || null === $plural ) { return $singular; } $translation = $this->controller->translate_plural( array( $singular, $plural ), (int) $count, (string) $context, $this->textdomain ); if ( false !== $translation ) { return $translation; } // Fall back to the original with English grammar rules. return ( 1 === $count ? $singular : $plural ); }