Make WordPress Core

Ticket #53635: 53635-09-script-translations.patch

File 53635-09-script-translations.patch, 2.0 KB (added by Chouby, 5 years ago)

Avoid notices in untrailingslashit() due to the default value of script translations path being null instead of an empty string. Also the doc blocks don't document null as an accepted value for the path.

  • src/wp-includes/class.wp-scripts.php

    diff --git src/wp-includes/class.wp-scripts.php src/wp-includes/class.wp-scripts.php
    index 0f38a48618..4979779350 100644
    class WP_Scripts extends WP_Dependencies {  
    562562         * @param string $path   Optional. The full file path to the directory containing translation files.
    563563         * @return bool True if the text domain was registered, false if not.
    564564         */
    565         public function set_translations( $handle, $domain = 'default', $path = null ) {
     565        public function set_translations( $handle, $domain = 'default', $path = '' ) {
    566566                if ( ! isset( $this->registered[ $handle ] ) ) {
    567567                        return false;
    568568                }
  • src/wp-includes/functions.wp-scripts.php

    diff --git src/wp-includes/functions.wp-scripts.php src/wp-includes/functions.wp-scripts.php
    index 82d3685672..e45e9a0fb1 100644
    function wp_localize_script( $handle, $object_name, $l10n ) {  
    237237 * @param string $path   Optional. The full file path to the directory containing translation files.
    238238 * @return bool True if the text domain was successfully localized, false otherwise.
    239239 */
    240 function wp_set_script_translations( $handle, $domain = 'default', $path = null ) {
     240function wp_set_script_translations( $handle, $domain = 'default', $path = '' ) {
    241241        global $wp_scripts;
    242242
    243243        if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
  • src/wp-includes/l10n.php

    diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
    index 3922805a87..db1cae60fd 100644
    function load_child_theme_textdomain( $domain, $path = false ) {  
    10081008 * @return string|false The translated strings in JSON encoding on success,
    10091009 *                      false if the script textdomain could not be loaded.
    10101010 */
    1011 function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
     1011function load_script_textdomain( $handle, $domain = 'default', $path = '' ) {
    10121012        $wp_scripts = wp_scripts();
    10131013
    10141014        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {