Changeset 44395
- Timestamp:
- 01/04/2019 09:11:01 PM (6 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-scripts.php
r44239 r44395 500 500 * 501 501 * @since 5.0.0 502 * @since 5.1.0 The `$domain` parameter was made optional. 502 503 * 503 504 * @param string $handle Name of the script to register a translation domain to. 504 * @param string $domain The textdomain.505 * @param string $domain Optional. Text domain. Default 'default'. 505 506 * @param string $path Optional. The full file path to the directory containing translation files. 506 * 507 * @return bool True if the textdomain was registered, false if not. 508 */ 509 public function set_translations( $handle, $domain, $path = null ) { 507 * @return bool True if the text domain was registered, false if not. 508 */ 509 public function set_translations( $handle, $domain = 'default', $path = null ) { 510 510 if ( ! isset( $this->registered[ $handle ] ) ) { 511 511 return false; … … 518 518 $obj->deps[] = 'wp-i18n'; 519 519 } 520 520 521 return $obj->set_translations( $domain, $path ); 521 522 } -
trunk/src/wp-includes/functions.wp-scripts.php
r44350 r44395 210 210 * 211 211 * @since 5.0.0 212 * @since 5.1.0 The `$domain` parameter was made optional. 212 213 * 213 214 * @param string $handle Script handle the textdomain will be attached to. 214 * @param string $domain The textdomain.215 * @param string $domain Optional. Text domain. Default 'default'. 215 216 * @param string $path Optional. The full file path to the directory containing translation files. 216 * 217 * @return bool True if the textdomain was successfully localized, false otherwise. 218 */ 219 function wp_set_script_translations( $handle, $domain, $path = null ) { 217 * @return bool True if the text domain was successfully localized, false otherwise. 218 */ 219 function wp_set_script_translations( $handle, $domain = 'default', $path = null ) { 220 220 global $wp_scripts; 221 221 if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { -
trunk/src/wp-includes/l10n.php
r44318 r44395 899 899 * @since 5.0.0 900 900 * @since 5.0.2 Uses load_script_translations() to load translation data. 901 * @since 5.1.0 The `$domain` parameter was made optional. 901 902 * 902 903 * @see WP_Scripts::set_translations() 903 904 * 904 905 * @param string $handle Name of the script to register a translation domain to. 905 * @param string $domain The text domain.906 * @param string $domain Optional. Text domain. Default 'default'. 906 907 * @param string $path Optional. The full file path to the directory containing translation files. 907 908 * … … 909 910 * in JSON encoding otherwise. 910 911 */ 911 function load_script_textdomain( $handle, $domain , $path = null ) {912 function load_script_textdomain( $handle, $domain = 'default', $path = null ) { 912 913 $wp_scripts = wp_scripts(); 913 914 -
trunk/src/wp-includes/script-loader.php
r44391 r44395 467 467 468 468 $package_translations = array( 469 'api-fetch' => 'default',470 'blocks' => 'default',471 'block-library' => 'default',472 'components' => 'default',473 'edit-post' => 'default',474 'editor' => 'default',475 'format-library' => 'default',476 'keycodes' => 'default',477 'list-reusable-blocks' => 'default',478 'nux' => 'default',469 'api-fetch', 470 'blocks', 471 'block-library', 472 'components', 473 'edit-post', 474 'editor', 475 'format-library', 476 'keycodes', 477 'list-reusable-blocks', 478 'nux', 479 479 ); 480 480 … … 486 486 $scripts->add( $handle, $path, $dependencies, $version, 1 ); 487 487 488 if ( i sset( $package_translations[ $package ]) ) {489 $scripts->set_translations( $handle , $package_translations[ $package ]);488 if ( in_array( $package, $package_translations, true ) ) { 489 $scripts->set_translations( $handle ); 490 490 } 491 491 }
Note: See TracChangeset
for help on using the changeset viewer.