Action hook load_textdomain $domain variable

I use the load_textdomain action hook to list all active localization text domains with corresponding path to translation files.

function mo_location( $domain, $mofile ) {  
    if ( !is_array($GLOBALS['moloc']) )
            $GLOBALS['moloc'] = array();

    $GLOBALS['moloc'][$domain] = $mofile;
}

add_action( 'load_textdomain', 'mo_location', 10, 2 );

For some reason the $domain variable is not filled with a “default” text domain values. Does anybody know why?

Related posts

Leave a Reply

1 comment

  1. The default text domain is registered in wp_load.php before plugins are loaded. See the function wp_load_translations_early().

    So when you register your action callback, the text domain has been loaded already.

    For an alternative way to list all registered text domains see this answer: List of Default Translated Phrases.