This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

The search bar does not work in translations with GTranslate

Home Forums Product Support Forums Ajax Search Pro for WordPress Support The search bar does not work in translations with GTranslate

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #54192
    mirko_mtgXmirko_mtgX
    Participant

    Hello, we have a search bar in the header that works perfectly in the English version, but in the other languages it just keeps loading and no results appear. We use GTranslate for translations.
    I am attaching two screenshots so you can see what I mean.
    Can you provide a solution for this?
    Thanks

    • This topic was modified 1 year ago by mirko_mtgXmirko_mtgX.
    #54196
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Try this custom code snippet:

    add_filter('asp/ajax/headers/content_type', function($content_type) {
    	return 'text/plain';
    }, 99, 1);

    Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

    However the current implementation was recommended by GTranslate developers and should work as-is, so they probably changed something somewhere, as I’m seeing added HTML closing and opening tags littered into the response body – as well as some missing strings.

    #54197
    mirko_mtgXmirko_mtgX
    Participant

    Thank you for your quick response. It is working now, but the results are shown in English, which is the original language. For example, if I am in Spanish and search for any word, the results are the English pages. Is there a way to fix this?
    Thanks

    #54198
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Gtranslate should automatically translate that, as it’s a reverse proxy. You may have to ask their support about that, maybe there is an option you need to enable or something similar.

    I have spoken with them some time ago, and all I know is that it automatically translates everything. We were trying to figure out if there was a way to search the translated content, but apparently that’s not possible to access in any way by any plugin.

    #54199
    mirko_mtgXmirko_mtgX
    Participant

    Ok, thanks for your help. I’ll ask them and see if they can give me a solution.
    Best regards.

    #54292
    mirko_mtgXmirko_mtgX
    Participant

    You cannot access this content.

    #54294
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I honestly don’t know what they are reffering to either here. They want you to add something somewhere, but I don’t know what or where, I don’t understand unfortunately either. Is there no interface on the gTranslate settings to add like keyword exceptions or anything like that?

    We have spoken about 2-3 months ago with them, they suggested a modification which I have implemented already (changin the response to HTML). Then it was working just fine. The change is actually within the search, it was integrated to it. Now it does not work again with the change in place, so I guess there might have been a change on their side too.

    #54503
    mirko_mtgXmirko_mtgX
    Participant

    You cannot access this content.

    #54507
    Ernest MarcinkoErnest Marcinko
    Keymaster

    That code look okay to me, it doesn’t work?
    The hook seems to be correct as far as I can tell.

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