Exemplo n.º 1
0
 public function tearDown()
 {
     unset($GLOBALS['l10n']);
     unset($GLOBALS['l10n_unloaded']);
     _get_path_to_translation(null, true);
     parent::tearDown();
 }
Exemplo n.º 2
0
 public function tearDown()
 {
     $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
     remove_filter('theme_root', array($this, 'filter_theme_root'));
     remove_filter('stylesheet_root', array($this, 'filter_theme_root'));
     remove_filter('template_root', array($this, 'filter_theme_root'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
     unset($GLOBALS['l10n']);
     unset($GLOBALS['l10n_unloaded']);
     _get_path_to_translation(null, true);
     parent::tearDown();
 }
 /**
  * Changes the site's locale to the given one.
  *
  * Loads the translations, changes the global `$wp_locale` object and updates
  * all post type labels.
  *
  * @since 4.7.0
  * @access private
  *
  * @global WP_Locale $wp_locale The WordPress date and time locale object.
  *
  * @param string $locale The locale to change to.
  */
 private function change_locale($locale)
 {
     // Reset translation availability information.
     _get_path_to_translation(null, true);
     $this->load_translations($locale);
     $GLOBALS['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);
 }
Exemplo n.º 4
0
/**
 * Loads plugin and theme textdomains just-in-time.
 *
 * When a textdomain is encountered for the first time, we try to load
 * the translation file from `wp-content/languages`, removing the need
 * to call load_plugin_texdomain() or load_theme_texdomain().
 *
 * @since 4.6.0
 * @access private
 *
 * @see get_translations_for_domain()
 * @global array $l10n_unloaded An array of all text domains that have been unloaded again.
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return bool True when the textdomain is successfully loaded, false otherwise.
 */
function _load_textdomain_just_in_time($domain)
{
    global $l10n_unloaded;
    $l10n_unloaded = (array) $l10n_unloaded;
    // Short-circuit if domain is 'default' which is reserved for core.
    if ('default' === $domain || isset($l10n_unloaded[$domain])) {
        return false;
    }
    $translation_path = _get_path_to_translation($domain);
    if (false === $translation_path) {
        return false;
    }
    return load_textdomain($domain, $translation_path);
}