wp_load_translations_early

The timeline below displays how wordpress function wp_load_translations_early has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
 * @global WP_Locale              $wp_locale              WordPress date and time locale object.
 */
function wp_load_translations_early()
{
    global $wp_textdomain_registry, $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/class-wp-translation-controller.php';
    require_once ABSPATH . WPINC . '/l10n/class-wp-translations.php';
    require_once ABSPATH . WPINC . '/l10n/class-wp-translation-file.php';
    require_once ABSPATH . WPINC . '/l10n/class-wp-translation-file-mo.php';
    require_once ABSPATH . WPINC . '/l10n/class-wp-translation-file-php.php';
    require_once ABSPATH . WPINC . '/l10n.php';
    require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $locations = array();
    if (!$wp_textdomain_registry instanceof WP_Textdomain_Registry) {
        $wp_textdomain_registry = new WP_Textdomain_Registry();
    }
    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', $locale);
                    if (defined('WP_SETUP_CONFIG') && file_exists($location . '/admin-' . $locale . '.mo')) {
                        load_textdomain('default', $location . '/admin-' . $locale . '.mo', $locale);
                    }
                    break 2;
                }
            }
        }
        break;
    }
    $wp_locale = new WP_Locale();
}

WordPress Version: 6.3

/**
 * 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
 * @global WP_Locale              $wp_locale              WordPress date and time locale object.
 */
function wp_load_translations_early()
{
    global $wp_textdomain_registry, $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 . '/class-wp-textdomain-registry.php';
    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $locations = array();
    if (!$wp_textdomain_registry instanceof WP_Textdomain_Registry) {
        $wp_textdomain_registry = new WP_Textdomain_Registry();
    }
    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', $locale);
                    if (defined('WP_SETUP_CONFIG') && file_exists($location . '/admin-' . $locale . '.mo')) {
                        load_textdomain('default', $location . '/admin-' . $locale . '.mo', $locale);
                    }
                    break 2;
                }
            }
        }
        break;
    }
    $wp_locale = new WP_Locale();
}

WordPress Version: 6.2

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
 * @global WP_Locale              $wp_locale              WordPress date and time locale object.
 */
function wp_load_translations_early()
{
    global $wp_textdomain_registry, $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 . '/class-wp-textdomain-registry.php';
    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $locations = array();
    if (!$wp_textdomain_registry instanceof WP_Textdomain_Registry) {
        $wp_textdomain_registry = new WP_Textdomain_Registry();
    }
    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', $locale);
                    if (defined('WP_SETUP_CONFIG') && file_exists($location . '/admin-' . $locale . '.mo')) {
                        load_textdomain('default', $location . '/admin-' . $locale . '.mo', $locale);
                    }
                    break 2;
                }
            }
        }
        break;
    }
    $wp_locale = new WP_Locale();
}

WordPress Version: 1.1

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 */
function wp_load_translations_early()
{
    global $wp_locale, $wp_textdomain_registry;
    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 . '/class-wp-textdomain-registry.php';
    require_once ABSPATH . WPINC . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $locations = array();
    if (!$wp_textdomain_registry instanceof WP_Textdomain_Registry) {
        $wp_textdomain_registry = new WP_Textdomain_Registry();
    }
    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', $locale);
                    if (defined('WP_SETUP_CONFIG') && file_exists($location . '/admin-' . $locale . '.mo')) {
                        load_textdomain('default', $location . '/admin-' . $locale . '.mo', $locale);
                    }
                    break 2;
                }
            }
        }
        break;
    }
    $wp_locale = new WP_Locale();
}

WordPress Version: 5.5

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 */
function wp_load_translations_early()
{
    global $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 . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $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();
}

WordPress Version: 5.4

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @staticvar bool $loaded
 */
function wp_load_translations_early()
{
    global $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 . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries.
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $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();
}

WordPress Version: 5.3

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @staticvar bool $loaded
 */
function wp_load_translations_early()
{
    global $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 . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries
    require_once ABSPATH . WPINC . '/plugin.php';
    $locales = array();
    $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();
}

WordPress Version: 4.7

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global WP_Locale $wp_locale The WordPress date and time locale object.
 *
 * @staticvar bool $loaded
 */
function wp_load_translations_early()
{
    global $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 . '/class-wp-locale.php';
    require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
    // General libraries
    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();
}

WordPress Version: 4.3

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global string    $text_direction
 * @global WP_Locale $wp_locale      The WordPress date and time locale object.
 *
 * @staticvar bool $loaded
 */
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 . '/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();
}

WordPress Version: 4.0

/**
 * Attempt 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.
 *
 * @since 3.4.0
 * @access private
 *
 * @global $wp_locale The WordPress date and time locale object.
 */
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 . '/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();
}

WordPress Version: 3.7

/**
 * 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.
 *
 * @since 3.4.0
 * @access private
 */
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 . '/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();
}