$49 GRAYBYTE WORDPRESS FILE MANAGER $92

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/cepurhuye.rw/wp-content/plugins/elementor/core/utils/

HOME
Current File : /home/bravrvjk/cepurhuye.rw/wp-content/plugins/elementor/core/utils//assets-translation-loader.php
<?php

namespace Elementor\Core\Utils;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class Assets_Translation_Loader {

	public static function for_handles( array $handles, $domain = null, $replace_callback = null ) {
		self::set_domain( $handles, $domain );
		self::replace_translation_path( $handles, $replace_callback );
	}

	private static function set_domain( array $handles, $domain = null ) {
		if ( empty( $domain ) || ! is_string( $domain ) ) {
			return;
		}

		foreach ( $handles as $handle ) {
			wp_set_script_translations( $handle, $domain );
		}
	}

	/**
	 * The purpose of this function is to replace the requested translation file
	 * with a file that contains all the translations for specific scripts.
	 *
	 * When developing a module and using Webpack's dynamic load feature, the script will be split into multiple chunks.
	 * As a result, the WordPress translations expressions will also be split into multiple files.
	 * Therefore, we replace the requested translation file with another file (generated in the build process)
	 * that contains all the translations for the specific script (including dynamically loaded chunks).
	 *
	 * Want to go deeper? Read the following article:
	 *
	 * @see https://developer.wordpress.com/2022/01/06/wordpress-plugin-i18n-webpack-and-composer/
	 *
	 * @param array         $handles
	 * @param callable|null $replace_callback
	 */
	private static function replace_translation_path( array $handles, $replace_callback = null ) {
		$sources = self::map_handles_to_src( $handles );

		add_filter( 'load_script_textdomain_relative_path', function ( $relative_path, $src ) use ( $sources, $replace_callback ) {
			if ( ! in_array( $src, $sources, true ) ) {
				return $relative_path;
			}

			if ( is_callable( $replace_callback ) ) {
				return $replace_callback( $relative_path, $src );
			}

			return self::default_replace_translation( $relative_path );
		}, 10, 2 );
	}

	private static function map_handles_to_src( array $handles ) {
		return array_map( function ( $handle ) {
			return wp_scripts()->registered[ $handle ]->src;
		}, $handles );
	}

	private static function default_replace_translation( $relative_path ) {
		// Translations are always based on the non-minified filename.
		$relative_path_without_ext = preg_replace( '/(\.min)?\.js$/i', '', $relative_path );

		// By default, we suffix the file with `.strings` (e.g 'assets/js/editor.js' => 'assets/js/editor.strings.js').
		return implode( '.', [
			$relative_path_without_ext,
			'strings',
			'js',
		] );
	}
}


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
api
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
import-export
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
promotions
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
svg
--
4 Apr 2026 1.57 AM
bravrvjk / bravrvjk
0755
ab-test.php
2.446 KB
15 Sep 2025 2.10 PM
bravrvjk / bravrvjk
0644
assets-config-provider.php
1.486 KB
23 Aug 2023 5.47 PM
bravrvjk / bravrvjk
0644
assets-translation-loader.php
2.508 KB
21 Oct 2025 4.51 PM
bravrvjk / bravrvjk
0644
collection.php
10.133 KB
22 Dec 2025 5.25 PM
bravrvjk / bravrvjk
0644
exceptions.php
0.692 KB
17 Mar 2025 5.28 PM
bravrvjk / bravrvjk
0644
force-locale.php
3.555 KB
23 Apr 2023 3.22 PM
bravrvjk / bravrvjk
0644
hints.php
14.66 KB
30 Mar 2026 1.49 PM
bravrvjk / bravrvjk
0644
http.php
0.958 KB
23 Apr 2023 3.22 PM
bravrvjk / bravrvjk
0644
plugins-manager.php
2.84 KB
28 Apr 2025 11.15 AM
bravrvjk / bravrvjk
0644
static-collection.php
1.086 KB
21 Oct 2025 4.51 PM
bravrvjk / bravrvjk
0644
str.php
0.978 KB
17 Mar 2025 5.28 PM
bravrvjk / bravrvjk
0644
template-library-element-iterator.php
0.748 KB
30 Mar 2026 1.49 PM
bravrvjk / bravrvjk
0644
template-library-import-export-utils.php
7.196 KB
30 Mar 2026 1.49 PM
bravrvjk / bravrvjk
0644
template-library-snapshot-processor.php
6.241 KB
30 Mar 2026 1.49 PM
bravrvjk / bravrvjk
0644
version.php
3.778 KB
21 Oct 2025 4.51 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF