Hi. I made some translations using the Loco plugin, but none of the translations are applied to your plugin! loco plugin produces json file but the translation is not applied. It seems that the plugin has a bug.
@admintwentytwenty there is a problem. The Loco plugin generates several json files for different JavaScript texts. It is not possible to name all of them.
Ok, if you can send us the .po file we can convert it for you. Alternatively if you have po2json installed on your machine you can run this command to create it from the .po file:
@admintwentytwenty This should not be an issue and loco plugin compatibility should work. I don’t know why translating your plugin is so much trouble! I also used this code which doesn’t need uip-translations but it didn’t solve the problem.
/**
* Set translation script for JS
*/
public static function set_script_translations( $handles = array() ) {
if ( function_exists( 'wp_set_script_translations' ) && ! empty( $handles ) && sizeof( $handles ) > 0 ) {
foreach( $handles as $handle ){
wp_set_script_translations( $handle, 'uipress-lite', plugin_dir_path( __FILE__ ) . 'languages' );
}
}
}
This reply was modified 3 years, 5 months ago by themefour wp.
It’s because only two main scripts are loaded directly through WP core functions for uipress, the rest are imported through the script itself using JS import. That’s why creating multiple JSON files like loco does doesn’t work because the scripts are not enqueued, thus ‘wp_set_script_translations’ doesn’t load up each individual translation.
As I said, if you would like to share the translation with us we will happily convert it for you or if you would prefer not to do that then just let us know and we will close this issue.