2018-06-28 04:30:15 +02:00
|
|
|
/**
|
|
|
|
* @output wp-admin/js/language-chooser.js
|
|
|
|
*/
|
|
|
|
|
2014-08-04 22:47:16 +02:00
|
|
|
jQuery( function($) {
|
2018-06-28 04:24:43 +02:00
|
|
|
/*
|
|
|
|
* Set the correct translation to the continue button and show a spinner
|
|
|
|
* when downloading a language.
|
|
|
|
*/
|
2014-08-04 22:47:16 +02:00
|
|
|
var select = $( '#language' ),
|
|
|
|
submit = $( '#language-continue' );
|
2014-07-08 02:30:14 +02:00
|
|
|
|
2014-08-04 22:47:16 +02:00
|
|
|
if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
|
|
|
|
return;
|
|
|
|
}
|
2014-07-08 02:30:14 +02:00
|
|
|
|
2014-08-04 22:47:16 +02:00
|
|
|
select.focus().on( 'change', function() {
|
2018-06-28 04:24:43 +02:00
|
|
|
/*
|
|
|
|
* When a language is selected, set matching translation to continue button
|
|
|
|
* and attach the language attribute.
|
|
|
|
*/
|
2014-08-04 22:47:16 +02:00
|
|
|
var option = select.children( 'option:selected' );
|
|
|
|
submit.attr({
|
|
|
|
value: option.data( 'continue' ),
|
|
|
|
lang: option.attr( 'lang' )
|
2014-07-08 02:30:14 +02:00
|
|
|
});
|
2014-08-04 22:47:16 +02:00
|
|
|
});
|
2014-07-08 02:30:14 +02:00
|
|
|
|
2014-08-04 22:47:16 +02:00
|
|
|
$( 'form' ).submit( function() {
|
2018-06-28 04:24:43 +02:00
|
|
|
// Show spinner for languages that need to be downloaded.
|
2014-08-04 22:47:16 +02:00
|
|
|
if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
|
|
|
|
$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
|
|
|
|
}
|
|
|
|
});
|
2014-07-08 02:33:15 +02:00
|
|
|
|
2014-08-04 22:47:16 +02:00
|
|
|
});
|