Index: wp-includes/l10n.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/l10n.php	(revision 43779)
+++ wp-includes/l10n.php	(date 1543499012297)
@@ -895,7 +895,7 @@
 	$file_base       = $domain === 'default' ? $locale : $domain . '-' . $locale;
 	$handle_filename = $file_base . '-' . $handle . '.json';
 	if ( $path && file_exists( $path . '/' . $handle_filename ) ) {
-		return file_get_contents( $path . '/' . $handle_filename );
+		return load_script_translation( $path . '/' . $handle_filename, $handle, $domain );
 	}
 
 	$obj = $wp_scripts->registered[ $handle ];
@@ -935,7 +935,7 @@
 
 	// If the source is not from WP.
 	if ( false === $relative ) {
-		return false;
+		return load_script_translation( false, $handle, $domain );
 	}
 
 	// Translations are always based on the unminified filename.
@@ -945,15 +945,60 @@
 
 	$md5_filename = $file_base . '-' . md5( $relative ) . '.json';
 	if ( $path && file_exists( $path . '/' . $md5_filename ) ) {
-		return file_get_contents( $path . '/' . $md5_filename );
+		return load_script_translation( $path . '/' . $md5_filename, $handle, $domain );
 	}
 	if ( file_exists( $languages_path . '/' . $md5_filename ) ) {
-		return file_get_contents( $languages_path . '/' . $md5_filename );
+		return load_script_translation( $languages_path . '/' . $md5_filename, $handle, $domain );
+	}
+
+	return load_script_translation( false, $handle, $domain );
+}
+
+/**
+ * Load the translated strings for the given script handle and textdomain.
+ *
+ * @since 5.0.0
+ *
+ * @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 textdomain.
+ * @return string|false The JSON-encoded translated strings for the given script handle and textdomain. False if there are none.
+ */
+function load_script_translation( $file, $handle, $domain ) {
+	/**
+	 * Pre-filters the script translations for the given file, script handle and textdomain.
+	 *
+	 * @since 5.0.0
+	 *
+	 * @param string|false $json_translations If not false, will immediately return the translations in JSON-encoded format
+	 * @param string       $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 textdomain.
+	 */
+	$json_translations = apply_filters( 'pre_load_script_translation', false, $file, $handle, $domain );
+
+	if ( $json_translations ) {
+		return $json_translations;
 	}
 
-	return false;
-}
+	/**
+	 * Filters the file path for loading script translations for the given script handle and textdomain.
+	 *
+	 * @since 5.0.0
+	 *
+	 * @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 textdomain.
+	 */
+	$file = apply_filters( 'load_script_textdomain_file', $file, $handle, $domain );
+
+	if ( ! $file || ! is_readable( $file ) ) {
+		return false;
+	}
 
+	return file_get_contents( $file );
+}
+
 /**
  * Loads plugin and theme textdomains just-in-time.
  *
