Title: _WP_Dependency::set_translations
Published: December 6, 2018
Last modified: February 24, 2026

---

# _WP_Dependency::set_translations( string $domain, string $path ): bool

## In this article

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

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

Sets the translation domain for this dependency.

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

 `$domain`stringrequired

The translation textdomain.

`$path`stringoptional

The full file path to the directory containing translation files.

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

 bool False if $domain is not a string, true otherwise.

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

    ```php
    public function set_translations( $domain, $path = '' ) {
    	if ( ! is_string( $domain ) ) {
    		return false;
    	}
    	$this->textdomain        = $domain;
    	$this->translations_path = $path;
    	return true;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-dependency.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-dependency.php#L131)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-dependency.php#L131-L138)

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

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

## User Contributed Notes

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