I'm preparing a wordpress site for localisation. I've generated the pot, po and mo files and have gotten the translation working for the php files. However the text from the javascript files doesn't get translated.
When generating the .po file from the .pot, it does find the strings in the javascript files.
The javascript fragment:
let message = __("Some text",'fiboo-plugins');
$('<div id="participant-changed-message">' +
message
+ '</div>').insertBefore('table');
The php fragment where the script is enqueued:
wp_enqueue_script( 'fca-participants', plugins_url('/fiboo-plugins/fiboo-custom-account/public/participants/list/participants.js'), array( 'jquery', 'wp-i18n' ), NULL, true );
wp_set_script_translations('fca-participants', 'fiboo-plugins', plugin_dir_path(dirname(__FILE__) ). '/fiboo-plugins/languages/');
The php fragment where to text domain is loaded:
function load_fiboo_textdomain() {
load_plugin_textdomain('fiboo-plugins', false, basename( __DIR__ ) . '/languages/' );
}
add_action( 'plugins_loaded', 'load_fiboo_textdomain', 0 );