Excerpts from Plugin Handbook
The text domain must match the slug of the plugin. If your plugin is a
single file called my-plugin.php or it is contained in a folder called
my-plugin the domain name should be my-plugin. If your plugin is
hosted on wordpress.org it must be the slug of your plugin URL
(wordpress.org/plugins/). The text domain name must use dashes
and not underscores.
The text domain also needs to be added to the plugin header. WordPress
uses it to internationalize your plugin meta-data even when the plugin
is disabled. The text domain should be same as the one used when
loading the text domain.
/*
* Plugin Name: My Plugin
* Author: Plugin Author
* Text Domain: my-plugin
*/
The domain path is used so that WordPress knows where to find the
translation when the plugin is disabled. Only useful if the
translations are located in a separate language folder. For example,
if .mo files are located in the languages folder within your plugin
then Domain Path will be “/languages” and must be written with the
first slash. Defaults to the languages folder of the plugin:
/*
* Plugin Name: My Plugin
* Author: Plugin Author
* Text Domain: my-plugin
* Domain Path: /languages
*/
Answer
Let's assume that your plugin name is My Plugin and your translation is for Polish language. There will be three files: my-plugin.pot, my-plugin-pl_PL.po, and my-plugin-pl_PL.mo.
It is a good practice to put in your plugin's languages folder, one .pot file, and pairs of .po / .mo for each language.
Put the following files, my-plugin.pot, my-plugin-pl_PL.po, my-plugin-pl_PL.mo into '/wp-content/plugins/my-plugin/languages' folder.
The following code will be used to properly load your plugin text domain:
function my_init() {
load_plugin_textdomain( 'my-plugin', false, 'my-plugin/languages/' );
}
add_action( 'init', 'my_init' );
or, if you call it from a class:
function my_init() {
load_plugin_textdomain( 'my-plugin', false, 'my-plugin/languages/' );
}
add_action( 'init', array( $this, 'my_init' ) );