• Resolved Fantou

    (@fantou)


    Hello

    Query monitor informs me about this alert : Translation loading for the contextual-related-posts domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later.

    Is there a way to solve this ?

    Have a nice day

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Ajay

    (@ajay)

    I think this is because of the Freemius SDK which I need to update to the latest version this week.

    Do you have the trace from QM?

    Thread Starter Fantou

    (@fantou)

    Hi @ajay

    Thanks for your reply. Here is what I get about this warning :

    load_textdomain_just_in_time() wp-includes/l10n.php:1378 get_translations_for_domain() wp-includes/l10n.php:1408 translate() wp-includes/l10n.php:194 _()
    wp-includes/l10n.php:306
    WebberZone\C\A\S\Settings::get_settings_sections()
    wp-content/plugins/contextual-related-posts/includes/admin/settings/class-settings.php:240
    WebberZone\C\A\S\Settings::get_registered_settings()
    wp-content/plugins/contextual-related-posts/includes/admin/settings/class-settings.php:268
    crp_settings_defaults()
    wp-content/plugins/contextual-related-posts/includes/options-api.php:215
    crp_get_default_option()
    wp-content/plugins/contextual-related-posts/includes/options-api.php:254
    crp_get_option()
    wp-content/plugins/contextual-related-posts/includes/options-api.php:57
    WebberZone\Contextual_Related_Posts\Main->hooks()
    wp-content/plugins/contextual-related-posts/includes/class-main.php:131
    WebberZone\Contextual_Related_Posts\Main->init()
    wp-content/plugins/contextual-related-posts/includes/class-main.php:116
    WebberZone\Contextual_Related_Posts\Main::get_instance()
    wp-content/plugins/contextual-related-posts/includes/class-main.php:92
    WebberZone\Contextual_Related_Posts\load()
    wp-content/plugins/contextual-related-posts/contextual-related-posts.php:112
    do_action('plugins_loaded')
    wp-includes/plugin.php:517
    Plugin Author Ajay

    (@ajay)

    Thanks for this. It looks like me and looks like a rather annoying issue of how I’m loading the plugin to run. Let me dig into this and see if I can get this fixed soon.

    Thread Starter Fantou

    (@fantou)

    Thanks for your very quick answer. I wish you good luck for the fix ! ??

    Plugin Author Ajay

    (@ajay)

    Thank you. Just to let you know, I’ve filed it in GitHub here: https://github.com/WebberZone/contextual-related-posts/issues/209

    So, I’ll mark this forum thread as resolved. If you’re on GitHub you can monitor this from here.

    Plugin Author Ajay

    (@ajay)

    When I went to fix this, I realised that I was loading the translation too early. Are you in a position to change this file and check?

    https://github.com/WebberZone/contextual-related-posts/blob/master/includes/frontend/class-language-handler.php#L28

    The hook needs to init and not plugins_loaded

    Thread Starter Fantou

    (@fantou)

    Unfortunatly, I have the same warning even after the change. I copy/paste your new code in the class-language-handler.php file with the editor of cpanel.

    After that I’ve checked with query monitor but same warning. It works on your side ?

    Plugin Author Ajay

    (@ajay)

    I aasume you’re running a different language right? I need to run a custom language set up and see if I can replicate this.

    Thread Starter Fantou

    (@fantou)

    Yes indeed. I’m running in french language

    Plugin Author Ajay

    (@ajay)

    @fantou I tried to replicate this and realised the issue is with French as there is a language pack. I know what the problem exactly is now, but I need to figure out a clean solution.

    Plugin Author Ajay

    (@ajay)

    @fantou

    I believe I’ve been able to fix this with some minor code edits: https://github.com/WebberZone/contextual-related-posts/commit/aeb75b92527a27879b77bac0cee9ac0360924844

    By passing a default value as you can see in the lines above, I’m able to bypass the call to the function that tries to force the translation.

    Thread Starter Fantou

    (@fantou)

    Hi @ajay ,

    Sorry for the late reply. And thank you for the fix, it works ! ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.