I create a plugin just for testing
/**
* @package SurveyPlugin
* @version 1.0
*/
/*
Plugin Name: Survey Plugin
Plugin URI: http:marcogomesweb.com
Description: This is survey
Author: NodeLondon
Version: 1.0
License: GPLv2 or later
Text Domain: survey-plugin
*/
function get_dummy_text() {
$text = [
__( 'city hotels' , 'survey-plugin' )
];
return $text[0];
}
add_action('admin_notices', 'show_dummy_text');
function show_dummy_text(){
$text = get_dummy_text();
global $locale;
echo "<br>". $locale . "<br>";
echo "<p id='wp-admin-motivation'>$text</p>";
}
add_action( 'plugins_loaded', 'wan_loaded_textdomain');
function wan_loaded_textdomain(){
$loadfiles = load_plugin_textdomain('survey-plugin', false,
dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
plugin_basename( __FILE__ ). '/languages/' );
var_dump($loadfiles); // is always false
}
I install Poedit I create a .mo file survey-plugi-es_ES.mo
in /plugins/survey-plugin/languages/
survey-plugi-es_ES.mo
msgid ""
msgstr ""
"Project-Id-Version: Survey Plugin\n"
"POT-Creation-Date: 2019-03-15 14:16+0000\n"
"PO-Revision-Date: 2019-03-15 14:16+0000\n"
"Language-Team: Marcogomesr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.1\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __\n"
"Last-Translator: \n"
"Language: es\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPath-1: survey-plugin.php\n"
"X-Poedit-SearchPathExcluded-0: src\n"
"X-Poedit-SearchPathExcluded-1: dist\n"
#: survey-plugin.php:79
msgid "city hotels"
msgstr "ciudad"
and this is what echo out
after changing the languages in the settings / site languages
still showing the same,
I’m following this tutorial but still having no idea why