wp_load_translations_early [ WordPress Function ]
| Access: |
|
| Defined at: |
|
Attempts an early load of translations.
Used for errors encountered during the initial loading process, before the locale has been properly detected and loaded.
Designed for unusual load sequences (like setup-config.php) or for when the script will then terminate with an error, otherwise there is a risk that a file can be double-included.
Source
<?php
function wp_load_translations_early() {
global $text_direction, $wp_locale;
static $loaded = false;
if ( $loaded )
return;
$loaded = true;
if ( function_exists( 'did_action' ) && did_action( 'init' ) )
return;
// We need $wp_local_package
require ABSPATH . WPINC . '/version.php';
// Translation and localization
require_once ABSPATH . WPINC . '/pomo/mo.php';
require_once ABSPATH . WPINC . '/l10n.php';
require_once ABSPATH . WPINC . '/locale.php';
// General libraries
require_once ABSPATH . WPINC . '/functions.php';
require_once ABSPATH . WPINC . '/plugin.php';
$locales = $locations = array();
while ( true ) {
if ( defined( 'WPLANG' ) ) {
if ( '' == WPLANG )
break;
$locales[] = WPLANG;
}
if ( isset( $wp_local_package ) )
$locales[] = $wp_local_package;
if ( ! $locales )
break;
if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
$locations[] = WP_LANG_DIR;
if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
$locations[] = WP_CONTENT_DIR . '/languages';
if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
$locations[] = ABSPATH . 'wp-content/languages';
if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
$locations[] = ABSPATH . WPINC . '/languages';
if ( ! $locations )
break;
$locations = array_unique( $locations );
foreach ( $locales as $locale ) {
foreach ( $locations as $location ) {
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
break 2;
}
}
}
break;
}
$wp_locale = new WP_Locale();
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- PHPXRef 0.7 : WordPress : /wp-load.php source
'/version.php' ); 50 51 wp_load_translations_early(); 52 wp_check_php_mysql_versions(); 53 54 // Die with an error message 55 $die = __( "There doesn't seem ...
phpxref.ftwr.co.uk - PHPXRef 0.7 : WordPress (Trunk) : /wp-includes/load.php source
'/db.php' ) ) { 112 wp_load_translations_early(); 113 wp_die( __( 'Your PHP ... '/ maintenance.php' ); 158 die(); 159 } 160 161 wp_load_translations_early(); 162 ...
lab.yukei.net - php /** * These functions are needed to load - WordPress SVN
'/db.php' ) ) { wp_load_translations_early(); wp_die( __( 'Your PHP installation appears ... '/maintenance.php' ); die(); } wp_load_translations_early(); $protocol ...
core.svn.wordpress.org - wp_check_php_mysql_versions (WordPress Function) - WPSeek.com
wp_load_translations_early(); wp_die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version ...
wpseek.com