Languages: English • Deutsch • Italiano • (Add your language)
Loads the plugin's translated strings.
If the path is not given then it will be the root of the plugin directory. The .mo file should be named based on the domain followed by a dash, and then the locale exactly. For example, the locale for German is 'de_DE', and the locale for Danish is 'da_DK'. If your plugin's text domain is "my-plugin" the Danish .mo and.po files should be named "my-plugin-da_DK.mo" and "my-plugin-da_DK.po" Call this function in your plugin as early as the plugins_loaded action.
If you call load_plugin_textdomain multiple times for the same domain, the translations will be merged. If both sets have the same string, the translation from the original value will be taken.
<?php load_plugin_textdomain( $domain, $abs_rel_path__DEPRECATED, $plugin_rel_path ) ?>
This example assumes that it is placed in the main plugin file, or at least a file in the plugin root. If it's not, you'll need to adjust the plugin_dir_path() call accordingly.
/** * Load plugin textdomain. * * @since 1.0.0 */ function myplugin_load_textdomain() { load_plugin_textdomain( 'my-plugin', false, basename( dirname( __FILE__ ) ) . '/languages' ); } add_action( 'plugins_loaded', 'myplugin_load_textdomain' );
load_plugin_textdomain() is located in wp-includes/l10n.php
.
Localization: get_locale(), load_textdomain(), load_default_textdomain(), load_plugin_textdomain(), load_theme_textdomain()