At the moment i'm developing my first wordpress plugin and want to include multi-language function in it. May be there is some manuals on it? Tried to google, but only get best wordpress language switcher plugin.

1 Answer 1


Basically read the source for the function load_plugin_textdomain():

function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false )

Ignore the second parameter, it was deprecated a long time ago.

An example from my plugin T5 Taxonomy Location:

protected function load_language()
        plugin_basename( dirname( __FILE__ ) ) . '/languages'

The first parameter is the text domain, the last the path to the languages directory in the plugin.

Now you can use strings in your plugin with that text domain:

__( 'Locations', 'plugin_t5_tax_location' )

There are multiple tools available to create new translations. I have used Codestyling Localization in the past, but it is broken now unfortunately.

  • What is wrong here: function load_language(){ load_plugin_textdomain('dleToWp', FALSE, dirname(plugin_basename( __FILE__ )).'/languages/'); } add_action('plugins_loaded', 'load_language'); add_management_page(__('Title', 'dleToWp'), __('Convert database', 'dleToWp'), 'manage_options', 'database_convert', array($this, 'settings_page')); wp-content/plugins/dleToWP/languages/ru_RU.mo Dec 31, 2012 at 17:08
  • Maybe the trailing slash?
    – fuxia
    Dec 31, 2012 at 17:12
  • And second question, how do you manage to use protect method? I jus added in to the constructor ` add_action('plugins_loaded', array($this, 'load_language')); ` and it fails Dec 31, 2012 at 17:24
  • I am calling this method in my constructor. See the source code of the plugin.
    – fuxia
    Dec 31, 2012 at 17:26
  • i am not so well in both oop and wordpress, but may be you can give small tip if this line possible add_action('init', array('myClass', 'constructor')); Dec 31, 2012 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.