[jQuery] Re: JSON data issue in IE | Language Translation
how'd you fix it? On Sep 25, 3:11 pm, Arif [EMAIL PROTECTED] wrote: I have resolved this :) Thanks Mohammed Arifhttp://www.mohammedarif.com On Sep 22, 2:24 pm, Arif [EMAIL PROTECTED] wrote: Even I got the issue, it's not been rendering because of French accented characters in IE. So what do I need to change theJSONcharacter encoding? P.S: I don't have server control, can change the front end layer (xhtml/css/js/json) only, and will not be able to write any server side code otherwise I could have easily done it. Many thanks Mohammed Arifhttp://www.mohammedarif.com On Sep 22, 11:12 am, Arif [EMAIL PROTECTED] wrote: Hi All, Hope, you all would be doing well. I am trying to create a language translation utility using jQuery for some specific words only, seems working fine in Firefox but don’t do well in IE 6/7. Given is theJSONfile, where I map headings which needs to be translated in French. JSONData: { download : télécharger, categories : sujets d'actualité, recent_comments : mais que l'histoire de l', recent posts : Messages Récents, also worthy : aussi digne, archieves : archives, } I am able to load myJSONfile successfully using $.getJSON(), it translates in FF but does not do the same in IE 6/7. jQuery Method: function loadJSON(){ $.getJSON(json/data_ca_fr.json, function(json){ $(.json_trans).each(function(i){ //getting all the headings to translate switch($(.json_trans)[i].innerHTML) { case Download: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML =json.download; break;// Stop here case Categories: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML =json.categories; break;// Stop here default break; } }) }); } I am just comparing English words in the page through innerHTML because jQuery html() return the first array index only , defined span tag with .json_trans class for picking up all the required spans and do the translation. I know, it’s not the robust way to do the language translation but does require for client and it’s not AJAX at all, just calling the jsonfile on dom ready. Any quick pointer/ suggestion should be appreciated. Thanks for your time Mohammed Arifhttp://www.mohammedarif.com
[jQuery] Re: JSON data issue in IE | Language Translation
It was because of EditPlus :) By default, it saves HTML encoding in ANSI format that was the reason not translating French characters properly. It should be UTF-8 instead of ANSI encode. And here we go with the shorter version of previous posted jQuery code: $.getJSON(json/data_ca_fr.json, function(json){ $(.json_trans).each(function(i){ var temp = $(.json_trans)[i].innerHTML; $(.json_trans)[i].innerHTML = eval(json. + temp); }) }); Need not to compare lots of innerHTML with JSON values but make sure that you have the same JSON key string download in the html [i.e. span class=json_transdownload/span] Hope it helps someone for sure. Thanks Mohammed Arif On Oct 15, 10:04 am, Gus [EMAIL PROTECTED] wrote: how'd you fix it? On Sep 25, 3:11 pm, Arif [EMAIL PROTECTED] wrote: I have resolved this :) Thanks Mohammed Arifhttp://www.mohammedarif.com On Sep 22, 2:24 pm, Arif [EMAIL PROTECTED] wrote: Even I got the issue, it's not been rendering because of French accented characters in IE. So what do I need to change theJSONcharacter encoding? P.S: I don't have server control, can change the front end layer (xhtml/css/js/json) only, and will not be able to write any server side code otherwise I could have easily done it. Many thanks Mohammed Arifhttp://www.mohammedarif.com On Sep 22, 11:12 am, Arif [EMAIL PROTECTED] wrote: Hi All, Hope, you all would be doing well. I am trying to create a language translation utility using jQuery for some specific words only, seems working fine in Firefox but don’t do well in IE 6/7. Given is theJSONfile, where I map headings which needs to be translated in French. JSONData: { download : télécharger, categories : sujets d'actualité, recent_comments : mais que l'histoire de l', recent posts : Messages Récents, also worthy : aussi digne, archieves : archives, } I am able to load myJSONfile successfully using $.getJSON(), it translates in FF but does not do the same in IE 6/7. jQuery Method: function loadJSON(){ $.getJSON(json/data_ca_fr.json, function(json){ $(.json_trans).each(function(i){ //getting all the headings to translate switch($(.json_trans)[i].innerHTML) { case Download: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML =json.download; break;// Stop here case Categories: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML =json.categories; break;// Stop here default break; } }) }); } I am just comparing English words in the page through innerHTML because jQuery html() return the first array index only , defined span tag with .json_trans class for picking up all the required spans and do the translation. I know, it’s not the robust way to do the language translation but does require for client and it’s not AJAX at all, just calling the jsonfile on dom ready. Any quick pointer/ suggestion should be appreciated. Thanks for your time Mohammed Arifhttp://www.mohammedarif.com
[jQuery] Re: JSON data issue in IE | Language Translation
I have resolved this :) Thanks Mohammed Arif http://www.mohammedarif.com On Sep 22, 2:24 pm, Arif [EMAIL PROTECTED] wrote: Even I got the issue, it's not been rendering because of French accented characters in IE. So what do I need to change the JSON character encoding? P.S: I don't have server control, can change the front end layer (xhtml/css/js/json) only, and will not be able to write any server side code otherwise I could have easily done it. Many thanks Mohammed Arifhttp://www.mohammedarif.com On Sep 22, 11:12 am, Arif [EMAIL PROTECTED] wrote: Hi All, Hope, you all would be doing well. I am trying to create a language translation utility using jQuery for some specific words only, seems working fine in Firefox but don’t do well in IE 6/7. Given is the JSON file, where I map headings which needs to be translated in French. JSON Data: { download : télécharger, categories : sujets d'actualité, recent_comments : mais que l'histoire de l', recent posts : Messages Récents, also worthy : aussi digne, archieves : archives, } I am able to load my JSON file successfully using $.getJSON(), it translates in FF but does not do the same in IE 6/7. jQuery Method: function loadJSON(){ $.getJSON(json/data_ca_fr.json, function(json){ $(.json_trans).each(function(i){ //getting all the headings to translate switch($(.json_trans)[i].innerHTML) { case Download: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML = json.download; break;// Stop here case Categories: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML = json.categories; break;// Stop here default break; } }) }); } I am just comparing English words in the page through innerHTML because jQuery html() return the first array index only , defined span tag with .json_trans class for picking up all the required spans and do the translation. I know, it’s not the robust way to do the language translation but does require for client and it’s not AJAX at all, just calling the json file on dom ready. Any quick pointer/ suggestion should be appreciated. Thanks for your time Mohammed Arifhttp://www.mohammedarif.com
[jQuery] Re: JSON data issue in IE | Language Translation
Even I got the issue, it's not been rendering because of French accented characters in IE. So what do I need to change the JSON character encoding? P.S: I don't have server control, can change the front end layer (xhtml/css/js/json) only, and will not be able to write any server side code otherwise I could have easily done it. Many thanks Mohammed Arif http://www.mohammedarif.com On Sep 22, 11:12 am, Arif [EMAIL PROTECTED] wrote: Hi All, Hope, you all would be doing well. I am trying to create a language translation utility using jQuery for some specific words only, seems working fine in Firefox but don’t do well in IE 6/7. Given is the JSON file, where I map headings which needs to be translated in French. JSON Data: { download : télécharger, categories : sujets d'actualité, recent_comments : mais que l'histoire de l', recent posts : Messages Récents, also worthy : aussi digne, archieves : archives, } I am able to load my JSON file successfully using $.getJSON(), it translates in FF but does not do the same in IE 6/7. jQuery Method: function loadJSON(){ $.getJSON(json/data_ca_fr.json, function(json){ $(.json_trans).each(function(i){ //getting all the headings to translate switch($(.json_trans)[i].innerHTML) { case Download: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML = json.download; break;// Stop here case Categories: // Start here if $(.json_trans)[i].innerHTML == download $(.json_trans)[i].innerHTML = json.categories; break;// Stop here default break; } }) }); } I am just comparing English words in the page through innerHTML because jQuery html() return the first array index only , defined span tag with .json_trans class for picking up all the required spans and do the translation. I know, it’s not the robust way to do the language translation but does require for client and it’s not AJAX at all, just calling the json file on dom ready. Any quick pointer/ suggestion should be appreciated. Thanks for your time Mohammed Arifhttp://www.mohammedarif.com