WP_Translations::translate( string|null $singular, string|null $context = '' )
Translates a singular string.
Parameters
- $singular
-
(string|null) (Required) Singular string.
- $context
-
(string|null) (Optional) Context.
Default value: ''
Return
(string|null) Translation if it exists, or the unchanged singular string
Source
File: wp-includes/l10n/class-wp-translations.php
public function translate( $singular, $context = '' ) {
if ( null === $singular ) {
return null;
}
$translation = $this->controller->translate( $singular, (string) $context, $this->textdomain );
if ( false !== $translation ) {
return $translation;
}
// Fall back to the original.
return $singular;
}
Changelog
| Version | Description |
|---|---|
| 6.5.0 | Introduced. |