Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Issues on translating En in other languages
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 10 months, 2 weeks ago.
- AuthorPosts
- October 10, 2023 at 12:30 am #45641
Hello,
We have installef GTranslate for translations in other languages and we have some issues at translations the Ajax Search PRO section. Here is the link: https://docpro.doc.ro/patients/find-a-clinical-trial
We are on the EN langauge but after we select Spanish language for example and from Conditions we select any of them the results bring us in English language in this situation GTranslate can not translate. It;s because the Content-Type is text/plain
so is possible to helps us to change Content-Type from text/plain to application/json ?Attached 3 screenshots to better understanding.
Best regards
Attachments:
You must be logged in to view attached files.October 10, 2023 at 9:41 am #45651Hi,
Sure, I can help you with that, but it requires changing one of the core files unfortuantely. I need to inform you that this change may have some negative effects, as the response body is not in json format, so the other plugin may encounter issues when trying to deserialize.
To change the header type:
– Open up thewp-content\plugins\ajax-search-pro\includes\classes\Hooks\Ajax\Search.php
file on your server
– Go to line 121, which should be this:Ajax::prepareHeaders();
– Change it to:Ajax::prepareHeaders('application/json');
– Save the fileNow the responses from the live search are marked with the
Best,application/json
header.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 10, 2023 at 9:52 pm #45667Hello,
Thank you so much for your support. I’ve added the code on the line 121 but still text appears to be there. Attached screenshots
You can test here aso: https://docpro.doc.ro/es/los-pacientes/encontrar-un-ensayo-cl%C3%ADnicoAttachments:
You must be logged in to view attached files.October 11, 2023 at 8:50 am #45670You are welcome!
If you check the network panel, the response header is now application/json: https://i.imgur.com/LabH6Ux.png
Best,
I suspect the translator requires actual JSON data to translate, but the data is not in JSON format. By changing the header will not change the data format to JSON.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 15, 2023 at 9:49 pm #45706Hello,
I understand. We try to find another solution.
I added in AJax Search selector post Category (Categories) (please see ajax1.png) on this link: https://docpro.doc.ro/patients/find-a-clinical-trial. The problem is when we select for example Psoriatic Arthritis (see ajax2.png image attached) the problem is that when we select and click on Search the displayed results are all the categories that have posts (see attached image ajax3.png). How do I make it so that when a category is selected from the selector, for example Psoriatic Arthritis and then we click on the Search button, it redirects on the same tab or to the new tab directly to the Psoriatic Arthritis category (https://docpro.doc.ro/category/psoriatic-arthritis) not to all Categories how is happening now.Best regards
Attachments:
You must be logged in to view attached files.October 17, 2023 at 3:23 pm #45728Hi,
Okay – so make sure you don’t have any categories as results selected, filtering categories by categories has no effect: https://i.imgur.com/fRVtMUn.png
Best,
Instead choose the posts to be returned based on the category filtering: https://i.imgur.com/zjU4RPG.png
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 19, 2023 at 8:26 am #45758Hello,
Thank you so much for your great support. Is there any possibility to set it in such a way that when we click in a selection it redirects to the post category for example https://docpro.doc.ro/category/psoriatic-arthritis to make other settings but these steps and the resultBest regards,
AlexOctober 19, 2023 at 10:02 am #45762Hi Alex,
I’m afraid that may not be possible unfortunately. I would suggest a custom script to somehow make it happen, but unfortunately the filters only hold the category ID on the client side. To make a redirection to the category page that information is not sufficient, because in WordPress it is not possible to redirect to a term page via the term ID (as far as I know).
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.