Support » Plugin: Simple Cookie Control » SCC customizer strings not translatable

  • Hi @sumapress,

    My client is using qTranslate XT to translate the content of their multilingual site.
    Today I added your wonderful plugin but found that the SCC Customizer strings where not translatable.

    I had a look at your plugin PHP code and noticed that you start running your plugin directly instead of on the init event.
    This prevents any translation plugin to do its magic.

    This simple change solved the problem:

    
    function run_simple_cookie_control() {
    	$plugin = new Simple_Cookie_Control();
    	$plugin->run();
    }
    add_action('init', 'run_simple_cookie_control'); 
    //run_simple_cookie_control();
    

    Could you please put this in your next release?

    Thanks.

    Cheers,
    Benny

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author sumapress

    (@sumapress)

    Sorry but I am not sure what plugin are you using, so please give me the link.

    Regarding the comments, that’s not a “simple change” because of you cannot delay the entire code of a plugin at that time: ‘init’. Thanks for your comments but I can´t do that 🙂

    Since everything within the plugin is registered via hooks, then kicking off the plugin from this point in the file does not affect the page life cycle.

    pd: https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/blob/master/plugin-name/plugin-name.php

    Thread Starter Benny

    (@bvl)

    The plugin is: https://github.com/qtranslate/qtranslate-xt
    This is a fork of qTranslate-X.

    But I am pretty sure the same problem will occur with any multilingual plugin.
    The author of Polylang expalins the issue here: https://polylang.pro/dont-take-any-action-before-plugins_loaded-is-fired/

    Since everything within the plugin is registered via hooks, then kicking off the plugin from this point in the file does not affect the page life cycle.

    I understand, but then one of your internal hooks is maybe running your code to early because the translation plugin isn’t initialized at that point and isn’t able to offer it’s translation functionality.

    Thread Starter Benny

    (@bvl)

    Maybe this helps:

    qTranslate adds for any option in the DB a filter to process its content:
    add_filter( 'option_' . $option, ...

    In your class Simple_Cookie_Control_Public you read the option in the constructor.
    It seems this happens before the plugins_loaded action and thus before any third party plugin has a chance to add option filters.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SCC customizer strings not translatable’ is closed to new replies.