WordPress. Локализация плагина, шаблона

Пример кода для локализации плагина/шаблона.

function _internationalization()
{
	$basename = basename( __FILE__ );
	$basepath = plugin_basename( __FILE__ );
	$basepath = str_replace( $basename, '', $basepath );

	$loaded = load_plugin_textdomain( 'redux-framework', false, $basepath . 'languages');

	if ( !$loaded ){
		$loaded = load_muplugin_textdomain( 'redux-framework', $basepath . 'languages' );
	}

	if ( !$loaded ){
		$loaded = load_theme_textdomain( 'redux-framework', $basepath . 'languages' );
	}

	if ( ! $loaded ) {
		$locale = apply_filters( 'plugin_locale', get_locale(), 'redux-framework' );
		$mofile = dirname( __FILE__ ) . '/languages/redux-framework-' . $locale . '.mo';
		load_textdomain( 'redux-framework', $mofile );
	}
}

или

load_plugin_textdomain( 'plugin-name', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 

https://wp-kama.ru/function/is_textdomain_loaded
https://wp-kama.ru/function/load_textdomain
https://wp-kama.ru/function/load_plugin_textdomain
https://wp-kama.ru/function/load_theme_textdomain