Forum Archive - Why can't you translate JSON responses?

Why can't you translate JSON responses?
Jun 25, 2015 1:34 pm by clickfwd
Hello I am the developer of JReviews and we recommend your extension to clients as the most viable solution to create a multilingual site. However, more and more clients come back to us telling us that some parts of JReviews are not translated and that your reply is that we should change our code to respond with HTML instead of JSON. I read some other posts here where you say the same thing. Why is that? JSON is very commonly used as a reply to AJAX requests and it is more efficient than returning HTML because the payload is smaller, which makes for faster requests, and because the results can be easily parsed and processed on the browser using javascript. I understand that it is more comfortable for you to just limit doing a mass translation on HTML, but you could also take your product to the next level and process JSON. You already intercept the request response so you could convert the JSON object to an ARRAY, then translate the values in the array. You could even go as far as letting clients specify which "key names" in the array should not be translated, and to take it further you could let clients specify which types of JSON requests based on URI format should be translated and which left alone. As developers of a very complex product for almost 10 years now we don't see how moving towards 100% responses in HTML is the future and we are not able to re-write our code to move backwards. On the other hand, we believe that since you are in the business of intercepting responses and manipulating the data you could probably provide added value by also supporting the translation of requests that return a JSON response. I hope that you seriously consider this as it could further improve your already great product and make it 100% compatible with all extensions. Maybe there are technical limitations as to why you can't translate JSON and if that's the case it would also be good to know exactly what these are so clients understand that the limitation is a technical one. I tried to find a contact email no your site to write to you directly, but I couldn't find one so forgive me for posting this in the forum. Alejandro
Re: Why can't you translate JSON responses?
Jun 25, 2015 7:32 pm by Edvard
Hi, Thanks for contacting me and your kind words. There is no general way to translate JSON object, because if we translate all JSON key values, most likely it will break the javascript. There is no general solution to know which keys should be translated and which not, because we provide general translation to all kind of applications including JReviews and I'm sure that many key names are general and can be used by many applications. May be we can work together and you can add some specific key names in your JSON responses, so we can detect and translate specified key values. For example you may add gt_translate_keys key inside your JSON responses, which will include the list of keys we may translate. That way we can detect the keys and translate the mentioned values. I think that it will be better to solve this between us developers and do not confuse users. Let me know. Thanks!
Re: Why can't you translate JSON responses?
Jun 25, 2015 7:37 pm by clickfwd
Hi I think for users it's good to have a general understanding of the challenges. Let me know how to reach you directly so we can look into possible solutions. Or use the contact us link at jreviews.com to get in touch with me. Alejandro
Re: Why can't you translate JSON responses?
Jun 25, 2015 7:44 pm by Edvard
You can write to my email address: [email protected] Hopefully we can find a solution, so clients will use our software without even knowing about the challenges, but it requires input from both sides. Thanks!

SIMILAR TOPICS

wordpress amp link not translateDec 31, 2016 10:11 amReplies: 12Post by: besybuy
Translate website to any specific language, on page loadJan 19, 2019 6:49 amReplies: 1Post by: Leaon7756
Best way to translate a page in WordPress?Jan 7, 2019 11:10 amReplies: 3Post by: Tonnystark
how to translate site right to left for arabic in WordPressDec 26, 2018 9:02 amReplies: 1Post by: Hammond753
Moving GT Translate Above HeaderDec 7, 2018 9:26 amReplies: 1Post by: mrlee

Try GTranslate with a free 15 day trial