• Resolved JBZ

    (@mahdijbz)


    Hi there,

    I am using this plugin beside Ultimate member plugin.

    But unfortunately while it has downloaded the translation for the Ultimate member plugin, but while I visit the account or login page in the other languages it does not show the correct translation for the strings come from the ultimate member plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter JBZ

    (@mahdijbz)

    I analysed the plugin. It sets the locale late while it loaded before the Ultimate Member. So when I echo the locale in UM plugin it clearly shows at first the get_locale() function returns en_US and later de_DE. So is there any suggestion for solving this issue to set the locale faster before other plugins start to use it ???

    Thread Starter JBZ

    (@mahdijbz)

    One stupid solution that I find is like the following:

    if ( trp_enable_translatepress() ) {
    	require_once plugin_dir_path( __FILE__ ) . 'class-translate-press.php';
    
    	/** License classes includes here
    	 * Since version 1.4.6
    	 * It need to be outside of a hook so it load before the classes that are in the addons, that we are trying to phase out
    	 */
    	require_once plugin_dir_path( __FILE__ ) . 'includes/class-edd-sl-plugin-updater.php';
    	
    	/* make sure we execute our plugin before other plugins so the changes we make apply across the board */
    	//add_action( 'plugins_loaded', 'trp_run_translatepress_hooks', 10 );
    	trp_run_translatepress_hooks();
    }
    function trp_run_translatepress_hooks(){
    	$trp = TRP_Translate_Press::get_trp_instance();
    	$trp->run();
    }

    So as you see I changed one line of index.php file. I changed the ‘plugins_loaded’ hook and directly called the trp_run_translatepress_hooks function. It causes to run this plugin before others.

    Now let me know can you confirm it as a good solution or you can offer me a better solution.

    Plugin Author Cristian Antohe

    (@sareiodata)

    Thank you for reporting this.

    Uhm, not sure really. I’ve opened an issue with the UM compatibility, but right now I don’t know if we should initialize TP bellow plugins_loaded.

    That being said, can you try with

    `
    add_action( ‘plugins_loaded’, ‘trp_run_translatepress_hooks’, 0 );
    `

    Thread Starter JBZ

    (@mahdijbz)

    I tried already. Even I tried with -99999999 and it does not resolve the issue.
    Just if I remove the add_action hook and call it immediately then it will resolve the issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘TranslatePress does not switch the translation for ultimate member’ is closed to new replies.