WP_Locale example


    private function change_locale( $locale ) {
        global $wp_locale;

        $this->load_translations( $locale );

        $wp_locale = new WP_Locale();

        /** * Fires when the locale is switched to or restored. * * @since 4.7.0 * * @param string $locale The new locale. */
        do_action( 'change_locale', $locale );
    }
}
if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) {
    require $locale_file;
}
unset( $locale_file );

/** * WordPress Locale object for loading locale domain date and various strings. * * @global WP_Locale $wp_locale WordPress date and time locale object. * @since 2.1.0 */
$GLOBALS['wp_locale'] = new WP_Locale();

/** * WordPress Locale Switcher object for switching locales. * * @since 4.7.0 * * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object. */
$GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
$GLOBALS['wp_locale_switcher']->init();

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><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p> <h2><?php _e( 'Information needed' ); ?></h2> <p>
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo', $locale );
                    }

                    break 2;
                }
            }
        }

        break;
    }

    $wp_locale = new WP_Locale();
}

/** * Checks or sets whether WordPress is in "installation" mode. * * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`. * * @since 4.4.0 * * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off. * Omit this parameter if you only want to fetch the current status. * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will * report whether WP was in installing mode prior to the change to `$is_installing`. */
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';
        }
        if ( ! empty( $loaded_language ) ) {
            $step_1 .= '&amp;language=' . $loaded_language;
        }
        
Home | Imprint | This part of the site doesn't use cookies.