# wp_set_script_translations()

URL: https://chugunov.pro/api-wordpress/functions/wp_set_script_translations/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 5.0.0.

## Сигнатура

```php
wp_set_script_translations( string $handle, string $domain = 'default', string $path = '' ): bool
```

## Описание

Works only if the script has already been registered.[See also](#see-also)
- [WP_Scripts::set_translations()](https://developer.wordpress.org/reference/classes/WP_Scripts/set_translations/)

## Параметры

- `$handle` `string` — обязательный. Дескриптор скрипта, к которому будет привязан текстовый домен.
- `$domain` `string` — необязательный, по умолчанию `'default'`. Текстовый домен. Значение по умолчанию — 'default'.
- `$path` `string` — необязательный, по умолчанию `''`. Полный путь к каталогу, содержащему файлы переводов.

## Возвращаемое значение

`bool`

## Исходный код

Файл: `wp-includes/functions-wp-scripts.php:342`

```php
function wp_set_script_translations( $handle, $domain = 'default', $path = '' ) {
	global $wp_scripts;

	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
		return false;
	}

	return $wp_scripts->set_translations( $handle, $domain, $path );
}
```

## История изменений

- 5.1.0 — The $domain parameter was made optional.
- 5.0.0 — Introduced.

## Связанные

Использует: `WP_Scripts::set_translations`.
Используется в: [`register_block_script_handle`](https://chugunov.pro/api-wordpress/functions/register_block_script_handle/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/wp_set_script_translations/
