wp_download_language_pack example


    }

    if ( isset( $_POST['locale'] ) ) {
        $locale = sanitize_text_field( $_POST['locale'] );
        if ( 'site-default' === $locale ) {
            $locale = '';
        } elseif ( '' === $locale ) {
            $locale = 'en_US';
        } elseif ( ! in_array( $localeget_available_languages(), true ) ) {
            if ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
                if ( ! wp_download_language_pack( $locale ) ) {
                    $locale = '';
                }
            } else {
                $locale = '';
            }
        }

        $user->locale = $locale;
    }

    if ( $update ) {
        
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 ) {
                load_default_textdomain( $loaded_language );
                $GLOBALS['wp_locale'] = new WP_Locale();
            }
        }

        $scripts_to_print[] = 'user-profile';

        display_header();
        ?> <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> <p>
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 ) {
                load_default_textdomain( $loaded_language );
                $GLOBALS['wp_locale'] = new WP_Locale();
            }
        }

        setup_config_display_header();
        $step_1 = 'setup-config.php?step=1';
        if ( isset( $_REQUEST['noapi'] ) ) {
            $step_1 .= '&amp;noapi';
        }
        
$meta = array(
        'public' => 1,
    );

    // Handle translation installation for the new site.     if ( isset( $_POST['WPLANG'] ) ) {
        if ( '' === $_POST['WPLANG'] ) {
            $meta['WPLANG'] = ''; // en_US         } elseif ( in_array( $_POST['WPLANG']get_available_languages(), true ) ) {
            $meta['WPLANG'] = $_POST['WPLANG'];
        } elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
            $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) );
            if ( $language ) {
                $meta['WPLANG'] = $language;
            }
        }
    }

    if ( empty( $title ) ) {
        wp_die( __( 'Missing site title.' ) );
    }

    if ( empty( $domain ) ) {
        
'fileupload_maxk',
        'illegal_names',
        'limited_email_domains',
        'banned_email_domains',
        'WPLANG',
        'new_admin_email',
        'first_comment_email',
    );

    // Handle translation installation.     if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
        $language = wp_download_language_pack( $_POST['WPLANG'] );
        if ( $language ) {
            $_POST['WPLANG'] = $language;
        }
    }

    foreach ( $options as $option_name ) {
        if ( ! isset( $_POST[ $option_name ] ) ) {
            continue;
        }
        $value = wp_unslash( $_POST[ $option_name ] );
        update_site_option( $option_name$value );
    }
        if ( ! empty( $_POST['timezone_string'] ) && preg_match( '/^UTC[+-]/', $_POST['timezone_string'] ) ) {
            $_POST['gmt_offset']      = $_POST['timezone_string'];
            $_POST['gmt_offset']      = preg_replace( '/UTC\+?/', '', $_POST['gmt_offset'] );
            $_POST['timezone_string'] = '';
        }

        // Handle translation installation.         if ( ! empty( $_POST['WPLANG'] ) && current_user_can( 'install_languages' ) ) {
            require_once ABSPATH . 'wp-admin/includes/translation-install.php';

            if ( wp_can_install_language_pack() ) {
                $language = wp_download_language_pack( $_POST['WPLANG'] );
                if ( $language ) {
                    $_POST['WPLANG'] = $language;
                }
            }
        }
    }

    if ( $options ) {
        $user_language_old = get_user_locale();

        foreach ( $options as $option ) {
            
Home | Imprint | This part of the site doesn't use cookies.