Filter hook 'ngettext_with_context'

in WP Core File wp-includes/l10n.php at line 558

View Source

ngettext_with_context

Filter Hook
Description
Filters the singular or plural form of a string with gettext context.

Hook Information

File Location wp-includes/l10n.php View on GitHub
Hook Type Filter
Line Number 558

Hook Parameters

Type Name Description
string $translation Translated text.
string $single The text to be used if the number is singular.
string $plural The text to be used if the number is plural.
int $number The number to compare against to use either the singular or plural form.
string $context Context information for the translators.
string $domain Text domain. Unique identifier for retrieving translated strings.

Usage Examples

Basic Usage
<?php
// Hook into ngettext_with_context
add_filter('ngettext_with_context', 'my_custom_filter', 10, 6);

function my_custom_filter($translation, $single, $plural, $number, $context, $domain) {
    // Your custom filtering logic here
    return $translation;
}

Source Code Context

wp-includes/l10n.php:558 - How this hook is used in WordPress core
<?php
 553  	 * @param string $plural      The text to be used if the number is plural.
 554  	 * @param int    $number      The number to compare against to use either the singular or plural form.
 555  	 * @param string $context     Context information for the translators.
 556  	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
 557  	 */
 558  	$translation = apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
 559  
 560  	/**
 561  	 * Filters the singular or plural form of a string with gettext context for a domain.
 562  	 *
 563  	 * The dynamic portion of the hook name, `$domain`, refers to the text domain.

PHP Documentation

<?php
/**
	 * Filters the singular or plural form of a string with gettext context.
	 *
	 * @since 2.8.0
	 *
	 * @param string $translation Translated text.
	 * @param string $single      The text to be used if the number is singular.
	 * @param string $plural      The text to be used if the number is plural.
	 * @param int    $number      The number to compare against to use either the singular or plural form.
	 * @param string $context     Context information for the translators.
	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 6
  • File: wp-includes/l10n.php
Related Hooks

Related hooks will be displayed here in future updates.