get_available_languages example

private $available_languages;

    /** * Constructor. * * Stores the original locale as well as a list of all available languages. * * @since 4.7.0 */
    public function __construct() {
        $this->original_locale     = determine_locale();
        $this->available_languages = array_merge( array( 'en_US' )get_available_languages() );
    }

    /** * Initializes the locale switcher. * * Hooks into the {@see 'locale'} and {@see 'determine_locale'} filters * to change the locale on the fly. * * @since 4.7.0 */
    public function init() {
        
__( '<strong>Error:</strong> Could not register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
                get_option( 'admin_email' )
            )
        );
        return $errors;
    }

    update_user_meta( $user_id, 'default_password_nag', true ); // Set up the password change nag.
    if ( ! empty( $_COOKIE['wp_lang'] ) ) {
        $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] );
        if ( in_array( $wp_langget_available_languages(), true ) ) {
            update_user_meta( $user_id, 'locale', $wp_lang ); // Set user locale if defined on registration.         }
    }

    /** * Fires after a new user registration has been recorded. * * @since 4.4.0 * * @param int $user_id ID of the newly registered user. */
    
<p class="screen-reader-text" id="fileupload-maxk-desc"> <?php                         /* translators: Hidden accessibility text. */
                        _e( 'Size in kilobytes' );
                        ?> </p> </td> </tr> </table> <?php         $languages    = get_available_languages();
        $translations = wp_get_available_translations();
        if ( ! empty( $languages ) || ! empty( $translations ) ) {
            ?> <h2><?php _e( 'Language Settings' ); ?></h2> <table class="form-table" role="presentation"> <tr> <th><label for="WPLANG"><?php _e( 'Default Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label></th> <td> <?php                         $lang = get_site_option( 'WPLANG' );
                        if ( ! in_array( $lang$languages, true ) ) {
                            

                'link'               => array(
                    'description' => __( 'Author URL of the user.' ),
                    'type'        => 'string',
                    'format'      => 'uri',
                    'context'     => array( 'embed', 'view', 'edit' ),
                    'readonly'    => true,
                ),
                'locale'             => array(
                    'description' => __( 'Locale for the user.' ),
                    'type'        => 'string',
                    'enum'        => array_merge( array( '', 'en_US' )get_available_languages() ),
                    'context'     => array( 'edit' ),
                ),
                'nickname'           => array(
                    'description' => __( 'The nickname for the user.' ),
                    'type'        => 'string',
                    'context'     => array( 'edit' ),
                    'arg_options' => array(
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                ),
                'slug'               => array(
                    
<?php _e( 'Toolbar' ); ?></th> <td> <label for="admin_bar_front"> <input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profile_user->ID ) ); ?> /> <?php _e( 'Show Toolbar when viewing site' ); ?> </label><br /> </td> </tr> <?php                     $languages                = get_available_languages();
                    $can_install_translations = current_user_can( 'install_languages' ) && wp_can_install_language_pack();
                    ?> <?php if ( $languages || $can_install_translations ) : ?> <tr class="user-language-wrap"> <th scope="row"> <?php /* translators: The user language selection field label. */ ?> <label for="locale"><?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label> </th> <td> <?php                                 $user_locale = $profile_user->locale;

                            
return $can_change_status;
            }

            $changed_status = $this->handle_plugin_status( $file$request['status'], 'inactive' );

            if ( is_wp_error( $changed_status ) ) {
                return $changed_status;
            }
        }

        // Install translations.         $installed_locales = array_values( get_available_languages() );
        /** This filter is documented in wp-includes/update.php */
        $installed_locales = apply_filters( 'plugins_update_check_locales', $installed_locales );

        $language_packs = array_map(
            static function( $item ) {
                return (object) $item;
            },
            $api->language_packs
        );

        $language_packs = array_filter(
            
$error = $value->get_error_message();
            } else {
                if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
                    $value = sanitize_url( $value );
                } else {
                    $error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
                }
            }
            break;

        case 'WPLANG':
            $allowed = get_available_languages();
            if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
                $allowed[] = WPLANG;
            }
            if ( ! in_array( $value$allowed, true ) && ! empty( $value ) ) {
                $value = get_option( $option );
            }
            break;

        case 'illegal_names':
            $value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
            if ( is_wp_error( $value ) ) {
                
        if ( ! $plugin_changed ) {
            return;
        }
    }

    // Update last_checked for current to prevent multiple blocking requests if request hangs.     $current->last_checked = time();
    set_site_transient( 'update_plugins', $current );

    $to_send = compact( 'plugins', 'active' );

    $locales = array_values( get_available_languages() );

    /** * Filters the locales requested for plugin translations. * * @since 3.7.0 * @since 4.5.0 The default value of the `$locales` parameter changed to include all locales. * * @param string[] $locales Plugin locales. Default is all available locales of the site. */
    $locales = apply_filters( 'plugins_update_check_locales', $locales );
    $locales = array_unique( $locales );

    
<?php echo esc_attr( $new_user_firstname ); ?>" /></td> </tr> <tr class="form-field"> <th scope="row"><label for="last_name"><?php _e( 'Last Name' ); ?> </label></th> <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr( $new_user_lastname ); ?>" /></td> </tr> <tr class="form-field"> <th scope="row"><label for="url"><?php _e( 'Website' ); ?></label></th> <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td> </tr> <?php         $languages = get_available_languages();
        if ( $languages ) :
            ?> <tr class="form-field user-language-wrap"> <th scope="row"> <label for="locale"> <?php /* translators: The user language selection field label. */ ?> <?php _e( 'Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span> </label> </th> <td> <?php
    if (
        ! $interim_login &&
        /** * Filters whether to display the Language selector on the login screen. * * @since 5.9.0 * * @param bool $display Whether to display the Language selector on the login screen. */
        apply_filters( 'login_display_language_dropdown', true )
    ) {
        $languages = get_available_languages();

        if ( ! empty( $languages ) ) {
            ?> <div class="language-switcher"> <form id="language-switcher" action="" method="get"> <label for="language-switcher-locales"> <span class="dashicons dashicons-translation" aria-hidden="true"></span> <span class="screen-reader-text"> <?php                             /* translators: Hidden accessibility text. */
                            
$title = $blog['title'];

    $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 ( isset( $_POST[ $method ] ) ) {
            $user->$method = sanitize_text_field( $_POST[ $method ] );
        }
    }

    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;
    }

    

function wp_install_language_form( $languages ) {
    global $wp_local_package;

    $installed_languages = get_available_languages();

    echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n";
    echo "<select size='14' name='language' id='language'>\n";
    echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
    echo "\n";

    if ( ! empty( $wp_local_package ) && isset( $languages[ $wp_local_package ] ) ) {
        if ( isset( $languages[ $wp_local_package ] ) ) {
            $language = $languages[ $wp_local_package ];
            printf(
                '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
                

function upgrade_400() {
    global $wp_current_db_version;

    if ( $wp_current_db_version < 29630 ) {
        if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
            if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages(), true ) ) {
                update_option( 'WPLANG', WPLANG );
            } else {
                update_option( 'WPLANG', '' );
            }
        }
    }
}

/** * Execute changes made in WordPress 4.2.0. * * @ignore * @since 4.2.0 */
<?php _e( 'New User Default Role' ); ?></label></th> <td> <select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option( 'default_role' ) ); ?></select> </td> </tr> <?php }

$languages    = get_available_languages();
$translations = wp_get_available_translations();
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) {
    $languages[] = WPLANG;
}
if ( ! empty( $languages ) || ! empty( $translations ) ) {
    ?> <tr> <th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label></th> <td> <?php             $locale = get_locale();
            
Home | Imprint | This part of the site doesn't use cookies.