• Resolved masouddarvishi1992

    (@masouddarvishi1992)


    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.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author UiPress

    (@admintwentytwenty)

    Hello, it’s not a bug – the JSON file just needs to be named a certain way for this to work. What is the name of the JSON js file the plugin created?

    Thread Starter masouddarvishi1992

    (@masouddarvishi1992)

    @admintwentytwenty

    uipress-lite-fa_IR-1bbe4d910d062c344022d80f6e6ba105.json

    https://ibb.co/31XsDtR

    Plugin Author UiPress

    (@admintwentytwenty)

    Cool, just rename it to this and it should work as expected:

    uipress-lite-fa_IR-uip-translations.json

    Thread Starter masouddarvishi1992

    (@masouddarvishi1992)

    @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.

    Plugin Author UiPress

    (@admintwentytwenty)

    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:

    po2json uipress-lite-fr_FR.po uipress-lite-fr_FR-uip-translations.json -f jed1
    Thread Starter masouddarvishi1992

    (@masouddarvishi1992)

    @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' );
    			}
    		}
    	}
    Plugin Author UiPress

    (@admintwentytwenty)

    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.

    Thread Starter masouddarvishi1992

    (@masouddarvishi1992)

    @admintwentytwenty I checked your site. There was no contact form or email address! I can send files via email.

    Plugin Author UiPress

    (@admintwentytwenty)

    You can use our on site chat to send the files

    Thread Starter masouddarvishi1992

    (@masouddarvishi1992)

    @admintwentytwenty I sent the files via chat. with the same name I created an account.

    Plugin Author UiPress

    (@admintwentytwenty)

    Thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Textdomain JS’ is closed to new replies.