Changeset 43825 for branches/5.0/src/wp-includes/functions.wp-scripts.php
- Timestamp:
- 10/25/2018 01:59:51 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/functions.wp-scripts.php
r38810 r43825 191 191 192 192 return $wp_scripts->localize( $handle, $object_name, $l10n ); 193 } 194 195 /** 196 * Register translated strings for a script. 197 * 198 * Works only if the script has already been added. 199 * 200 * @see WP_Scripts::set_translations() 201 * @link https://core.trac.wordpress.org/ticket/45103 202 * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. 203 * 204 * @since 5.0.0 205 * 206 * @param string $handle Script handle the textdomain will be attached to. 207 * @param string $domain The textdomain. 208 * @param string $path Optional. The full file path to the directory containing translation files. 209 * 210 * @return bool True if the textdomain was successfully localized, false otherwise. 211 */ 212 function wp_set_script_translations( $handle, $domain, $path = null ) { 213 global $wp_scripts; 214 if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { 215 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); 216 return false; 217 } 218 219 if ( ! wp_script_is( $handle, 'enqueued' ) ) { 220 _doing_it_wrong( __FUNCTION__, __( 'Script translations may only be set if the script is enqueued.' ), '5.0.0' ); 221 } 222 223 return $wp_scripts->set_translations( $handle, $domain, $path ); 193 224 } 194 225
Note: See TracChangeset
for help on using the changeset viewer.