On this page
Translations::translate( string $singular, string $context = null ): string
Parameters
$singularstring Required$contextstring Optional-
Default:
null
Return
string
Source
File: wp-includes/pomo/translations.php. View all references
public function translate( $singular, $context = null ) {
$entry = new Translation_Entry(
array(
'singular' => $singular,
'context' => $context,
)
);
$translated = $this->translate_entry( $entry );
return ( $translated && ! empty( $translated->translations ) ) ? $translated->translations[0] : $singular;
}
Related
Uses
| Uses | Description |
|---|---|
| Translation_Entry::__construct() wp-includes/pomo/entry.php | |
| Translations::translate_entry() wp-includes/pomo/translations.php |
Used By
| Used By | Description |
|---|---|
| translate() wp-includes/l10n.php | Retrieves the translation of $text. |
| translate_with_gettext_context() wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/translations/translate