# load_script_translations()

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

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

## Сигнатура

```php
load_script_translations( string|false $file, string $handle, string $domain ): string|false
```

## Описание

Загружает данные перевода для указанного дескриптора скрипта и текстового домена.

## Параметры

- `$file` `string|false` — обязательный. Путь к загружаемому файлу перевода. False, если его нет.
- `$handle` `string` — обязательный. Имя скрипта, для которого регистрируется домен перевода.
- `$domain` `string` — обязательный. Текстовый домен.

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

`string|false`

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

Файл: `wp-includes/l10n.php:1358`

```php
function load_script_translations( $file, $handle, $domain ) {
	/**
	 * Pre-filters script translations for the given file, script handle and text domain.
	 *
	 * Returning a non-null value allows to override the default logic, effectively short-circuiting the function.
	 *
	 * @since 5.0.2
	 *
	 * @param string|false|null $translations JSON-encoded translation data. Default null.
	 * @param string|false      $file         Path to the translation file to load. False if there isn't one.
	 * @param string            $handle       Name of the script to register a translation domain to.
	 * @param string            $domain       The text domain.
	 */
	$translations = apply_filters( 'pre_load_script_translations', null, $file, $handle, $domain );

	if ( null !== $translations ) {
		return $translations;
	}

	/**
	 * Filters the file path for loading script translations for the given script handle and text domain.
	 *
	 * @since 5.0.2
	 *
	 * @param string|false $file   Path to the translation file to load. False if there isn't one.
	 * @param string       $handle Name of the script to register a translation domain to.
	 * @param string       $domain The text domain.
	 */
	$file = apply_filters( 'load_script_translation_file', $file, $handle, $domain );

	if ( ! $file || ! is_readable( $file ) ) {
		return false;
	}

	$translations = file_get_contents( $file );

	/**
	 * Filters script translations for the given file, script handle and text domain.
	 *
	 * @since 5.0.2
	 *
	 * @param string $translations JSON-encoded translation data.
	 * @param string $file         Path to the translation file that was loaded.
	 * @param string $handle       Name of the script to register a translation domain to.
	 * @param string $domain       The text domain.
	 */
	return apply_filters( 'load_script_translations', $translations, $file, $handle, $domain );
}
```

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

- 5.0.2 — Introduced.

## Связанные

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

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