Title: WP_Translations::translate
Published: April 3, 2024
Last modified: August 20, 2026

---

# WP_Translations::translate( string|null $singular, string|null $context = ” ): string|null

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#wp--skip-link--target)

Translates a singular string.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#parameters)󠁿

 `$singular`string|nullrequired

Singular string.

`$context`string|nulloptional

Context.

Default:`''`

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#return)󠁿

 string|null Translation if it exists, or the unchanged singular string

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#source)󠁿

    ```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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n/class-wp-translations.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/l10n/class-wp-translations.php#L139)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/l10n/class-wp-translations.php#L139-L151)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_translations/translate/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.5.0](https://developer.wordpress.org/reference/since/6.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_translations%2Ftranslate%2F)
before being able to contribute a note or feedback.