Sandeep Kumar Mishra
Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

WordPress Multilingual Plugin development is super easy and increases your target audience. At WePlugins, our developers strictly follow the multilingual approach in any type of WordPress development.
Instead of defining ‘Internationalization’ or ‘Localization’ words theoretically, I’d like to develop a WordPress multilingual plugin from scratch so you can understand this perfectly.
Assuming you have little idea about wordpress plugin development, to start off, below is simple plugin code which creates two navigation and displays a dummy output.
/*
Plugin Name: WordPress Multilingual Plugin Tutorial
Description: Learn how to make a WordPress Multilingual Plugin.
Author: flippercode
Version: 1.0.0
Author URI: https://weplugins.com
*/
if(!class_exists('weplugins_Multilingual_Tutorial'))
{
class weplugins_Multilingual_Tutorial
{
/**
* Construct the plugin object
*/
public function __construct()
{
add_action('admin_menu', array($this, 'weplugins_multilingual_menu'));
} // END public function __construct
public function weplugins_multilingual_menu()
{
add_menu_page(
'Multilingual Tutorial',
'Multilingual Tutorial',
'manage_options',
'multilingual-tutorial',
array($this, 'weplugins_func_multilingual_tutorial')
);
add_submenu_page(
'multilingual-tutorial',
'Sub Menu',
'Sub Menu',
'manage_options',
'multilingual-tutorial-submenu',
array($this, 'weplugins_func_multilingual_tutorial_submenu')
);
}
public function weplugins_func_multilingual_tutorial()
{
echo "Hello, World is here";
}
public function weplugins_func_multilingual_tutorial_submenu()
{
echo "Hello, World is here";
}
}
}
// instantiate the plugin class
$weplugins_multilingual = new weplugins_Multilingual_Tutorial();
If you change your WordPress language using `define(‘WPLANG’, ‘hi_IN’);` in wp-config.php, this plugin doesn’t have any effect because it is not multilingual compatible WordPress plugin.
Below are simple changes we’ll do in this plugin to make it multilingual.
_e('Multilingual WordPress Plugin Tutorial', 'text-domain');
here our unique key is ‘text-domain’ which will be used throughout the plugin.
If you don’t want to output a translated string, use __($text,$domain) function.
$string = __('Multilingual WordPress Plugin Tutorial', 'text-domain');
So by using these two functions, we’re going to modify our plugin.
To make navigation multilingual, replace:
add_menu_page(
'Multilingual Tutorial',
'Multilingual Tutorial',
'manage_options',
'multilingual-tutorial',
array($this, 'weplugins_func_multilingual_tutorial')
);
add_submenu_page(
'multilingual-tutorial',
'Sub Menu',
'Sub Menu',
'manage_options',
'multilingual-tutorial-submenu',
array($this, 'weplugins_func_multilingual_tutorial_submenu')
);
With:
add_menu_page(
__('Multilingual Tutorial', 'text-domain'),
__('Multilingual Tutorial', 'text-domain'),
'manage_options',
'multilingual-tutorial',
array($this, 'weplugins_func_multilingual_tutorial')
);
add_submenu_page(
'multilingual-tutorial',
__('Sub Menu', 'text-domain'),
__('Sub Menu', 'text-domain'),
'manage_options',
'multilingual-tutorial-submenu',
array($this, 'weplugins_func_multilingual_tutorial_submenu')
);
To make contents multilingual, replace:
echo "Hello, World is here";
with:
_e("Hello, World is here", 'text-domain');
add_action('plugins_loaded', array($this, 'weplugins_plugin_init'));
function weplugins_plugin_init() {
load_plugin_textdomain('text-domain', false, dirname(plugin_basename(__FILE__)) . '/languages/');
}
Here assume that all languages file located in the languages folder within the plugin folder. So below is the complete source to make above plugin a multilingual.
To create languages files in WordPress, we use poedit software. Here are easy steps to create a .po file for your plugin on Creating POT Files.
Below is the screenshot of .po files for English and Hindi languages.

Did you notice file names here? It should have {domain}-{language_code}_{country_code}.po format. Here our {domain} is ‘text-domain’, {language_code} is ‘hi’ (Hindi) and {country_code} in ‘IN’ (India) so file name is ‘text-domain-hi_IN.po’.
Here is complete list of Languages Codes and Country Codes.
While WordPress defaults to English, changing the language is a straightforward process. Let’s walk through the steps to switch your site’s language to Hindi, which uses the locale code ‘hi’ and country code ‘IN’.
By following these steps, you can effectively test and verify the functionality of a multilingual plugin.
Conclusion
By applying some small steps, you can make your plugin or themes multilingual. The first time, you create an English version .po file and distribute that to the translator. You can place any number of languages files in your languages folder. More languages you’ll provide, more download you get on codecanyon or official repository.

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.