Tribe__Main::load_text_domain( string $domain, string|false $dir = false )

A Helper method to load text domain First it tries to load the wp-content/languages translation then if falls to the try to load $dir language files.


Parameters

$domain

(string) (Required) The text domain that will be loaded.

$dir

(string|false) (Optional) What directory should be used to try to load if the default doesn't work.

Default value: false


Top ↑

Return

(bool) If it was able to load the text domain.


Top ↑

Source

File: src/Tribe/Main.php

	public function load_text_domain( $domain, $dir = false ) {
		// Added safety just in case this runs twice...
		if ( is_textdomain_loaded( $domain ) && ! $GLOBALS['l10n'][ $domain ] instanceof NOOP_Translations ) {
			return true;
		}

		$locale = get_locale();
		$plugin_rel_path = WP_LANG_DIR . '/plugins/';

		/**
		 * Allows users to filter the file location for a given text domain
		 * Be careful when using this filter, it will apply across the whole plugin suite.
		 *
		 * @param string      $plugin_rel_path The relative path for the language files
		 * @param string      $domain Which plugin domain we are trying to load
		 * @param string      $locale Which Language we will load
		 * @param string|bool $dir    If there was a custom directory passed on the method call
		 */
		$plugin_rel_path = apply_filters( 'tribe_load_text_domain', $plugin_rel_path, $domain, $locale, $dir );

		$loaded = load_plugin_textdomain( $domain, false, $plugin_rel_path );

		if ( $dir !== false && ! $loaded ) {
			return load_plugin_textdomain( $domain, false, $dir );
		}

		return $loaded;
	}

Top ↑

Changelog

Changelog
Version Description
4.2 Included $domain and $dir params.
4.0.1 Introduced.