localization - WordPress Dataviews React multilanguage i18n

admin2025-01-07  5

I'm using React WP dataviews component in my plugin, but I can't load translation for the component.

OFFICIAL DOCS

I loaded plugin translation into php file with:

function umc_load_textdomain() {
    load_plugin_textdomain(
        'unused-media-cleaner',
        false,
        dirname( plugin_basename( __FILE__ ) ) . '/languages'
    );  
}
add_action( 'plugins_loaded', 'umc_load_textdomain' );

and I loaded script js translation into js file with:

wp_set_script_translations( 'umc-script', 'unused-media-cleaner', plugin_dir_path( __FILE__ ) . '/languages/' );

Plugin translation works fine and also translation inside js file. But the Dataviews component doesn't load languages.

I don't understand if I am doing something wrong.

I checked default WP domain into /languages/ and it contains string translation. I checked the same component on site-editor.php page using FSE and it loads translation correctly.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736259083a562.html

最新回复(0)