wp_install_language_form example

$scripts_to_print = array( 'jquery' );

switch ( $step ) {
    case 0: // Step 0.         if ( wp_can_install_language_pack() && empty( $language ) ) {
            $languages = wp_get_available_translations();
            if ( $languages ) {
                $scripts_to_print[] = 'language-chooser';
                display_header( 'language-chooser' );
                echo '<form id="setup" method="post" action="?step=1">';
                wp_install_language_form( $languages );
                echo '</form>';
                break;
            }
        }

        // Deliberately fall through if we can't reach the translations API.
    case 1: // Step 1, direct link or from language chooser.         if ( ! empty( $language ) ) {
            $loaded_language = wp_download_language_pack( $language );
            if ( $loaded_language ) {
                
$language = $GLOBALS['wp_local_package'];
}

switch ( $step ) {
    case -1:
        if ( wp_can_install_language_pack() && empty( $language ) ) {
            $languages = wp_get_available_translations();
            if ( $languages ) {
                setup_config_display_header( 'language-chooser' );
                echo '<h1 class="screen-reader-text">Select a default language</h1>';
                echo '<form id="setup" method="post" action="?step=0">';
                wp_install_language_form( $languages );
                echo '</form>';
                break;
            }
        }

        // Deliberately fall through if we can't reach the translations API.
    case 0:
        if ( ! empty( $language ) ) {
            $loaded_language = wp_download_language_pack( $language );
            if ( $loaded_language ) {
                
Home | Imprint | This part of the site doesn't use cookies.