Viewing 1 replies (of 1 total)
  • Cheers.
    Not all plugins are using a text domain for localization, but most of them do (if not very old ones).

    Example how to find a plugin text domain:
    In this example i’m using the Akismet plugin.

    • Navigate to the plugin folder
    • Find the .php file that is named as the the plugin or similar (in this case: akismet.php)
    • Open the file in a text editor (or the Editor in the WordPress Admin sidebar under ”Plugins”)
    • In the beginning of the file you will find the plugin info header, what we do here find the row that says Text Domain:
    • In this example the string is: Text Domain: akismet (so, the text domain for this plugin is akismet)

    If you look in other the other PHP files in the Akismet plugin folder (that we are using for this example), you will find code like (i added some explaining comments in the code snippet below):

    class Akismet_Widget extends WP_Widget {
    
    	function __construct() {
    	load_plugin_textdomain( 'akismet' ); //	 Loads the text domain for this plugin
    
    		parent::__construct(
    			'akismet_widget',
    		__( 'Akismet Widget' , 'akismet'),
    		/**
    		* 1.
    		* The lowercase "akismet" value is the text domain, and telling the plugin to get the
    		* translation for the words: "Akismet Widget" if there is one.
    		*/	
    
    			array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') )
    		);
    		/**
    		* 2.
    		* The lowercase "akismet" value is the text domain, and telling the plugin to get the
    		* translation for the sentence: "Display the number of spam comments Akismet has caught" if
    		* there is one.
    		*/
Viewing 1 replies (of 1 total)
  • The topic ‘How to find out Plugin "domain"’ is closed to new replies.