--- wp-includes/l10n.php	2019-01-07 14:42:46.000000000 +0100
+++ wp-includes/l10n.php	2019-01-13 22:41:47.000000000 +0100
@@ -138,7 +138,7 @@
 		$determined_locale = get_user_locale();
 	}
 
-	if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
+	if ( ! empty( $_GET['wp_lang'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
 		$determined_locale = sanitize_text_field( $_GET['wp_lang'] );
 	}
 
@@ -166,20 +166,22 @@
  *                       Default 'default'.
  * @return string Translated text
  */
-function translate( $text, $domain = 'default' ) {
-	$translations = get_translations_for_domain( $domain );
-	$translation  = $translations->translate( $text );
-
-	/**
-	 * Filters text with its translation.
-	 *
-	 * @since 2.0.11
-	 *
-	 * @param string $translation  Translated text.
-	 * @param string $text         Text to translate.
-	 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
-	 */
-	return apply_filters( 'gettext', $translation, $text, $domain );
+if (! function_exists('translate')) {
+	function translate( $text, $domain = 'default' ) {
+		$translations = get_translations_for_domain( $domain );
+		$translation  = $translations->translate( $text );
+
+		/**
+		 * Filters text with its translation.
+		 *
+		 * @since 2.0.11
+		 *
+		 * @param string $translation  Translated text.
+		 * @param string $text         Text to translate.
+		 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
+		 */
+		return apply_filters( 'gettext', $translation, $text, $domain );
+	}
 }
 
 /**
@@ -246,8 +248,10 @@
  *                       Default 'default'.
  * @return string Translated text.
  */
-function __( $text, $domain = 'default' ) {
-	return translate( $text, $domain );
+if (! function_exists('__')) {
+	function __( $text, $domain = 'default' ) {
+		return translate( $text, $domain );
+	}
 }
 
 /**
@@ -870,26 +874,23 @@
 }
 
 /**
- * Loads the script translated strings.
- *
- * @since 5.0.0
- * @since 5.0.2 Uses load_script_translations() to load translation data.
+ * Load the script translated strings.
  *
  * @see WP_Scripts::set_translations()
+ * @link https://core.trac.wordpress.org/ticket/45103
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 5.0.0
  *
  * @param string $handle Name of the script to register a translation domain to.
- * @param string $domain The text domain.
+ * @param string $domain The textdomain.
  * @param string $path   Optional. The full file path to the directory containing translation files.
  *
  * @return false|string False if the script textdomain could not be loaded, the translated strings
  *                      in JSON encoding otherwise.
  */
 function load_script_textdomain( $handle, $domain, $path = null ) {
-	$wp_scripts = wp_scripts();
-
-	if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
-		return false;
-	}
+	global $wp_scripts;
 
 	$path   = untrailingslashit( $path );
 	$locale = determine_locale();
@@ -897,20 +898,14 @@
 	// If a path was given and the handle file exists simply return it.
 	$file_base       = $domain === 'default' ? $locale : $domain . '-' . $locale;
 	$handle_filename = $file_base . '-' . $handle . '.json';
-
-	if ( $path ) {
-		$translations = load_script_translations( $path . '/' . $handle_filename, $handle, $domain );
-
-		if ( $translations ) {
-			return $translations;
-		}
+	if ( $path && file_exists( $path . '/' . $handle_filename ) ) {
+		return file_get_contents( $path . '/' . $handle_filename );
 	}
 
-	$src = $wp_scripts->registered[ $handle ]->src;
+	$obj = $wp_scripts->registered[ $handle ];
 
-	if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) {
-		$src = $wp_scripts->base_url . $src;
-	}
+	/** This filter is documented in wp-includes/class.wp-scripts.php */
+	$src = esc_url( apply_filters( 'script_loader_src', $obj->src, $handle ) );
 
 	$relative       = false;
 	$languages_path = WP_LANG_DIR;
@@ -922,39 +917,29 @@
 	// If the host is the same or it's a relative URL.
 	if (
 		strpos( $src_url['path'], $content_url['path'] ) === 0 &&
-		( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] )
+		( ! isset( $src_url['host'] ) || $src_url['host'] !== $content_url['host'] )
 	) {
 		// Make the src relative the specific plugin or theme.
-		$relative = trim( substr( $src_url['path'], strlen( $content_url['path'] ) ), '/' );
+		$relative = trim( substr( $src, strlen( $content_url['path'] ) ), '/' );
 		$relative = explode( '/', $relative );
 
 		$languages_path = WP_LANG_DIR . '/' . $relative[0];
 
 		$relative = array_slice( $relative, 2 );
 		$relative = implode( '/', $relative );
-	} elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) {
+	} elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] ) {
 		if ( ! isset( $site_url['path'] ) ) {
 			$relative = trim( $src_url['path'], '/' );
-		} elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) {
+		} elseif ( ( strpos( $src_url['path'], $site_url['path'] ) === 0 ) ) {
 			// Make the src relative to the WP root.
-			$relative = substr( $src_url['path'], strlen( $site_url['path'] ) );
+			$relative = substr( $src, strlen( $site_url['path'] ) );
 			$relative = trim( $relative, '/' );
 		}
 	}
 
-	/**
-	 * Filters the relative path of scripts used for finding translation files.
-	 *
-	 * @since 5.0.2
-	 *
-	 * @param string $relative The relative path of the script. False if it could not be determined.
-	 * @param string $src      The full source url of the script.
-	 */
-	$relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src );
-
 	// If the source is not from WP.
 	if ( false === $relative ) {
-		return load_script_translations( false, $handle, $domain );
+		return false;
 	}
 
 	// Translations are always based on the unminified filename.
@@ -963,81 +948,14 @@
 	}
 
 	$md5_filename = $file_base . '-' . md5( $relative ) . '.json';
-
-	if ( $path ) {
-		$translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain );
-
-		if ( $translations ) {
-			return $translations;
-		}
+	if ( $path && file_exists( $path . '/' . $md5_filename ) ) {
+		return file_get_contents( $path . '/' . $md5_filename );
 	}
-
-	$translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain );
-
-	if ( $translations ) {
-		return $translations;
-	}
-
-	return load_script_translations( false, $handle, $domain );
-}
-
-/**
- * Loads the translation data 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.
- * @return string|false The JSON-encoded translated strings for the given script handle and text domain. False if there are none.
- */
-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 $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;
+	if ( file_exists( $languages_path . '/' . $md5_filename ) ) {
+		return file_get_contents( $languages_path . '/' . $md5_filename );
 	}
 
-	/**
-	 * 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 );
+	return false;
 }
 
 /**
@@ -1472,9 +1390,9 @@
 
 /**
  * Determines whether the current locale is right-to-left (RTL).
- *
+ * 
  * For more information on this and similar theme functions, check out
- * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
+ * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 
  * Conditional Tags} article in the Theme Developer Handbook.
  *
  * @since 3.0.0
