function load_textdomain( $domain, $mofile ) {}

Loads a MO file into the domain $domain.
If the domain already exists, the translations will be merged. If both sets have the same string, the translation from the original value will be taken.


  • string $domain: Unique identifier for retrieving translated strings
  • string $mofile: Path to the .mo file

Return values

returns:True on success, false on failure

Defined filters

  • override_load_textdomain
    apply_filters( 'override_load_textdomain', false, $domain, $mofile )
  • load_textdomain_mofile
    apply_filters( 'load_textdomain_mofile', $mofile, $domain )

Defined actions

  • load_textdomain
    do_action( 'load_textdomain', $domain, $mofile );

Source code

function load_textdomain( $domain, $mofile ) {

	global $l10n;

	$plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );

	if ( true == $plugin_override ) {

		return true;


	do_action( 'load_textdomain', $domain, $mofile );

	$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );

	if ( !is_readable( $mofile ) ) return false;

	$mo = new MO();

	if ( !$mo->import_from_file( $mofile ) ) return false;

	if ( isset( $l10n[$domain] ) )

		$mo->merge_with( $l10n[$domain] );

	$l10n[$domain] = &$mo;

	return true;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: