gettext_with_context
Filters text with its translation based on context information.
Usage
add_filter( 'gettext_with_context', 'wp_kama_gettext_with_context_filter', 10, 4 ); /** * Function for `gettext_with_context` filter-hook. * * @param string $translation Translated text. * @param string $text Text to translate. * @param string $context Context information for the translators. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * * @return string */ function wp_kama_gettext_with_context_filter( $translation, $text, $context, $domain ){ // filter... return $translation; }
- $translation(string)
- Translated text.
- $text(string)
- Text to translate.
- $context(string)
- Context information for the translators.
- $domain(string)
- Text domain. Unique identifier for retrieving translated strings.
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
gettext_with_context
wp-includes/l10n.php 274
$translation = apply_filters( 'gettext_with_context', $translation, $text, $context, $domain );