_restore_after', $this->loaded_domains ); $this->has_loaded_translations = false; } /** * Load the translations for the map of domains for the current locale. * * @since 5.0.8 * * @param array $domains A map from text domains to the directory containing the translations. * @param string $locale The locale to load the translations for. * * @return void Translations for each domain will be loaded for the current plugin locale. */ protected function load_locale_translations( array $domains, string $locale ): void { global $l10n; if ( ! is_array( $l10n ) ) { $l10n = []; } foreach ( $domains as $domain => $lang_dir ) { unload_textdomain( $domain, true ); if ( $locale === 'en_US' ) { // There is no `en_US` language pack since it's the default, no-op the translations. $l10n[ $domain ] = new \NOOP_Translations(); } else { // Load the translations using the wrapper Common function. $dir = is_string( $lang_dir ) && ! empty( $lang_dir ) ? $lang_dir : false; \Tribe__Main::instance()->load_text_domain( $domain, $dir ); } } } }