CoreFiles by mySites.guru
language-chooser.js36 lines, 890 bytes, from wordpress-5.9.21.zip
Raw History Compare with 5.9.20
md5
9fd3a40b17ca6b758d916c4c5316a904
sha1
c0a7d1ff432bc926d9f43604c644537ebf462fbe
sha256
772d5e2d8e824f567b2dd20fbfe51c231d09efb47f3806eaf1f9ad74c8b1f442
/**
 * @output wp-admin/js/language-chooser.js
 */

jQuery( function($) {
/*
 * Set the correct translation to the continue button and show a spinner
 * when downloading a language.
 */
var select = $( '#language' ),
	submit = $( '#language-continue' );

if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
	return;
}

select.trigger( 'focus' ).on( 'change', function() {
	/*
	 * When a language is selected, set matching translation to continue button
	 * and attach the language attribute.
	 */
	var option = select.children( 'option:selected' );
	submit.attr({
		value: option.data( 'continue' ),
		lang: option.attr( 'lang' )
	});
});

$( 'form' ).on( 'submit', function() {
	// Show spinner for languages that need to be downloaded.
	if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
		$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
	}
});

});

The same content is in 389 releases, WordPress 5.7-RC1 to 7.2-RC2. See them all, or every version of this file.