{"action":"created","comment":{"url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/comments/29558574","id":29558574,"diff_hunk":"@@ -76,31 +60,111 @@ function translateOneRequestPerFewWords(words, prefs, callback) {\n     translateORPFWRec(concatWordsArray, 1, cWALength, tMap, prefs, callback);\n }\n \n+var translator = {\n+    translate: function(prefs, word) {}\n+};\n+\n+var googleTranslator = function() {};\n+googleTranslator.prototype = Object.create(translator);\n+\n+var yandexTranslator = function() {};\n+yandexTranslator.prototype = Object.create(translator);\n+\n+/**\n+ * @desc Constructs google translate url\n+ * @params User saved preferences\n+ * @params word to be translated\n+ * @return Google Translate query from source to destination language\n+ */\n+googleTranslator.prototype.translate = function(prefs, word, callback){\n+    var url = 'http://translate.google.com/translate_a/t?client=f&otf=1&pc=0&hl=en';\n+    var sL = prefs[\"sourceLanguage\"];\n+    if(sL != 'auto') {\n+        url += '&sl=' + sL;\n+    }\n+    url += '&tl=' + prefs[\"targetLanguage\"];\n+    url += '&text=';\n+    url += word;\n+\n+    getData(url, function(result){\n+        var tMap = {}\n+        for (i in result.sentences) {\n+            var orig = result.sentences[i].orig;\n+            var origT = orig.substring(0,orig.length - 1);\n+            var trans = result.sentences[i].trans;\n+            var transT = trans.replace(/[.\\u3002]/,\"\"); // removes punctuation\n+            tMap[origT] = transT;\n+        }\n+        callback(tMap);\n+    });\n+}\n+\n+yandexTranslator.prototype.translate = function(prefs, word, callback){\n+    var apikey = \"trnsl.1.1.20150429T202526Z.d63a1483e719555a.852f432bad29a4628c1d1694b6114c0efb22f183\"","path":"Source/background.js","position":76,"original_position":76,"commit_id":"360059095ff98a055af2c7c703db5ef899e3d433","original_commit_id":"360059095ff98a055af2c7c703db5ef899e3d433","user":{"login":"omesh","id":962668,"avatar_url":"https://avatars.githubusercontent.com/u/962668?v=3","gravatar_id":"","url":"https://api.github.com/users/omesh","html_url":"https://github.com/omesh","followers_url":"https://api.github.com/users/omesh/followers","following_url":"https://api.github.com/users/omesh/following{/other_user}","gists_url":"https://api.github.com/users/omesh/gists{/gist_id}","starred_url":"https://api.github.com/users/omesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omesh/subscriptions","organizations_url":"https://api.github.com/users/omesh/orgs","repos_url":"https://api.github.com/users/omesh/repos","events_url":"https://api.github.com/users/omesh/events{/privacy}","received_events_url":"https://api.github.com/users/omesh/received_events","type":"User","site_admin":false},"body":"makes sense.","created_at":"2015-05-03T18:18:06Z","updated_at":"2015-05-03T18:18:06Z","html_url":"https://github.com/OiWorld/MindTheWord/pull/44#discussion_r29558574","pull_request_url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/comments/29558574"},"html":{"href":"https://github.com/OiWorld/MindTheWord/pull/44#discussion_r29558574"},"pull_request":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44","id":34508304,"html_url":"https://github.com/OiWorld/MindTheWord/pull/44","diff_url":"https://github.com/OiWorld/MindTheWord/pull/44.diff","patch_url":"https://github.com/OiWorld/MindTheWord/pull/44.patch","issue_url":"https://api.github.com/repos/OiWorld/MindTheWord/issues/44","number":44,"state":"closed","locked":false,"title":"Adding option to pick yandex as a translation service.","user":{"login":"omesh","id":962668,"avatar_url":"https://avatars.githubusercontent.com/u/962668?v=3","gravatar_id":"","url":"https://api.github.com/users/omesh","html_url":"https://github.com/omesh","followers_url":"https://api.github.com/users/omesh/followers","following_url":"https://api.github.com/users/omesh/following{/other_user}","gists_url":"https://api.github.com/users/omesh/gists{/gist_id}","starred_url":"https://api.github.com/users/omesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omesh/subscriptions","organizations_url":"https://api.github.com/users/omesh/orgs","repos_url":"https://api.github.com/users/omesh/repos","events_url":"https://api.github.com/users/omesh/events{/privacy}","received_events_url":"https://api.github.com/users/omesh/received_events","type":"User","site_admin":false},"body":"Haven't tested the changes for all languages only tested it for french.\r\nSome issue remaining:-\r\nThe set of languages supported by different services is different so need some way to validated the languages that can be added for translation.\r\nNeed to have a map for language to its short form like french to fr, since for some languages it is different for google translate and yandex.\r\n\r\nSince google translate is currently not working because it is blocking calls I guess this will be good workaround for some users like me atleast.","created_at":"2015-04-30T22:42:24Z","updated_at":"2015-05-03T18:18:06Z","closed_at":"2015-05-03T03:18:37Z","merged_at":"2015-05-03T03:18:37Z","merge_commit_sha":"4341393b13cdf1ab1a536f231f2c14f9b25b38f3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44/commits","review_comments_url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44/comments","review_comment_url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OiWorld/MindTheWord/issues/44/comments","statuses_url":"https://api.github.com/repos/OiWorld/MindTheWord/statuses/360059095ff98a055af2c7c703db5ef899e3d433","head":{"label":"omesh:users/omeshp/yandexTranslator","ref":"users/omeshp/yandexTranslator","sha":"360059095ff98a055af2c7c703db5ef899e3d433","user":{"login":"omesh","id":962668,"avatar_url":"https://avatars.githubusercontent.com/u/962668?v=3","gravatar_id":"","url":"https://api.github.com/users/omesh","html_url":"https://github.com/omesh","followers_url":"https://api.github.com/users/omesh/followers","following_url":"https://api.github.com/users/omesh/following{/other_user}","gists_url":"https://api.github.com/users/omesh/gists{/gist_id}","starred_url":"https://api.github.com/users/omesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omesh/subscriptions","organizations_url":"https://api.github.com/users/omesh/orgs","repos_url":"https://api.github.com/users/omesh/repos","events_url":"https://api.github.com/users/omesh/events{/privacy}","received_events_url":"https://api.github.com/users/omesh/received_events","type":"User","site_admin":false},"repo":{"id":34572431,"name":"MindTheWord","full_name":"omesh/MindTheWord","owner":{"login":"omesh","id":962668,"avatar_url":"https://avatars.githubusercontent.com/u/962668?v=3","gravatar_id":"","url":"https://api.github.com/users/omesh","html_url":"https://github.com/omesh","followers_url":"https://api.github.com/users/omesh/followers","following_url":"https://api.github.com/users/omesh/following{/other_user}","gists_url":"https://api.github.com/users/omesh/gists{/gist_id}","starred_url":"https://api.github.com/users/omesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omesh/subscriptions","organizations_url":"https://api.github.com/users/omesh/orgs","repos_url":"https://api.github.com/users/omesh/repos","events_url":"https://api.github.com/users/omesh/events{/privacy}","received_events_url":"https://api.github.com/users/omesh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/omesh/MindTheWord","description":"An extension for Google Chrome that helps people learn new languages while they browse the web.","fork":true,"url":"https://api.github.com/repos/omesh/MindTheWord","forks_url":"https://api.github.com/repos/omesh/MindTheWord/forks","keys_url":"https://api.github.com/repos/omesh/MindTheWord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omesh/MindTheWord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omesh/MindTheWord/teams","hooks_url":"https://api.github.com/repos/omesh/MindTheWord/hooks","issue_events_url":"https://api.github.com/repos/omesh/MindTheWord/issues/events{/number}","events_url":"https://api.github.com/repos/omesh/MindTheWord/events","assignees_url":"https://api.github.com/repos/omesh/MindTheWord/assignees{/user}","branches_url":"https://api.github.com/repos/omesh/MindTheWord/branches{/branch}","tags_url":"https://api.github.com/repos/omesh/MindTheWord/tags","blobs_url":"https://api.github.com/repos/omesh/MindTheWord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omesh/MindTheWord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omesh/MindTheWord/git/refs{/sha}","trees_url":"https://api.github.com/repos/omesh/MindTheWord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omesh/MindTheWord/statuses/{sha}","languages_url":"https://api.github.com/repos/omesh/MindTheWord/languages","stargazers_url":"https://api.github.com/repos/omesh/MindTheWord/stargazers","contributors_url":"https://api.github.com/repos/omesh/MindTheWord/contributors","subscribers_url":"https://api.github.com/repos/omesh/MindTheWord/subscribers","subscription_url":"https://api.github.com/repos/omesh/MindTheWord/subscription","commits_url":"https://api.github.com/repos/omesh/MindTheWord/commits{/sha}","git_commits_url":"https://api.github.com/repos/omesh/MindTheWord/git/commits{/sha}","comments_url":"https://api.github.com/repos/omesh/MindTheWord/comments{/number}","issue_comment_url":"https://api.github.com/repos/omesh/MindTheWord/issues/comments{/number}","contents_url":"https://api.github.com/repos/omesh/MindTheWord/contents/{+path}","compare_url":"https://api.github.com/repos/omesh/MindTheWord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omesh/MindTheWord/merges","archive_url":"https://api.github.com/repos/omesh/MindTheWord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omesh/MindTheWord/downloads","issues_url":"https://api.github.com/repos/omesh/MindTheWord/issues{/number}","pulls_url":"https://api.github.com/repos/omesh/MindTheWord/pulls{/number}","milestones_url":"https://api.github.com/repos/omesh/MindTheWord/milestones{/number}","notifications_url":"https://api.github.com/repos/omesh/MindTheWord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omesh/MindTheWord/labels{/name}","releases_url":"https://api.github.com/repos/omesh/MindTheWord/releases{/id}","created_at":"2015-04-25T14:50:44Z","updated_at":"2015-05-03T13:03:59Z","pushed_at":"2015-05-03T13:05:57Z","git_url":"git://github.com/omesh/MindTheWord.git","ssh_url":"git@github.com:omesh/MindTheWord.git","clone_url":"https://github.com/omesh/MindTheWord.git","svn_url":"https://github.com/omesh/MindTheWord","homepage":null,"size":10432,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"OiWorld:master","ref":"master","sha":"b4938ee7f23a2320fdcf68e954326946a3185d12","user":{"login":"OiWorld","id":3678147,"avatar_url":"https://avatars.githubusercontent.com/u/3678147?v=3","gravatar_id":"","url":"https://api.github.com/users/OiWorld","html_url":"https://github.com/OiWorld","followers_url":"https://api.github.com/users/OiWorld/followers","following_url":"https://api.github.com/users/OiWorld/following{/other_user}","gists_url":"https://api.github.com/users/OiWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/OiWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OiWorld/subscriptions","organizations_url":"https://api.github.com/users/OiWorld/orgs","repos_url":"https://api.github.com/users/OiWorld/repos","events_url":"https://api.github.com/users/OiWorld/events{/privacy}","received_events_url":"https://api.github.com/users/OiWorld/received_events","type":"Organization","site_admin":false},"repo":{"id":8381792,"name":"MindTheWord","full_name":"OiWorld/MindTheWord","owner":{"login":"OiWorld","id":3678147,"avatar_url":"https://avatars.githubusercontent.com/u/3678147?v=3","gravatar_id":"","url":"https://api.github.com/users/OiWorld","html_url":"https://github.com/OiWorld","followers_url":"https://api.github.com/users/OiWorld/followers","following_url":"https://api.github.com/users/OiWorld/following{/other_user}","gists_url":"https://api.github.com/users/OiWorld/gists{/gist_id}","starred_url":"https://api.github.com/users/OiWorld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OiWorld/subscriptions","organizations_url":"https://api.github.com/users/OiWorld/orgs","repos_url":"https://api.github.com/users/OiWorld/repos","events_url":"https://api.github.com/users/OiWorld/events{/privacy}","received_events_url":"https://api.github.com/users/OiWorld/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OiWorld/MindTheWord","description":"An extension for Google Chrome that helps people learn new languages while they browse the web.","fork":false,"url":"https://api.github.com/repos/OiWorld/MindTheWord","forks_url":"https://api.github.com/repos/OiWorld/MindTheWord/forks","keys_url":"https://api.github.com/repos/OiWorld/MindTheWord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OiWorld/MindTheWord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OiWorld/MindTheWord/teams","hooks_url":"https://api.github.com/repos/OiWorld/MindTheWord/hooks","issue_events_url":"https://api.github.com/repos/OiWorld/MindTheWord/issues/events{/number}","events_url":"https://api.github.com/repos/OiWorld/MindTheWord/events","assignees_url":"https://api.github.com/repos/OiWorld/MindTheWord/assignees{/user}","branches_url":"https://api.github.com/repos/OiWorld/MindTheWord/branches{/branch}","tags_url":"https://api.github.com/repos/OiWorld/MindTheWord/tags","blobs_url":"https://api.github.com/repos/OiWorld/MindTheWord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OiWorld/MindTheWord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OiWorld/MindTheWord/git/refs{/sha}","trees_url":"https://api.github.com/repos/OiWorld/MindTheWord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OiWorld/MindTheWord/statuses/{sha}","languages_url":"https://api.github.com/repos/OiWorld/MindTheWord/languages","stargazers_url":"https://api.github.com/repos/OiWorld/MindTheWord/stargazers","contributors_url":"https://api.github.com/repos/OiWorld/MindTheWord/contributors","subscribers_url":"https://api.github.com/repos/OiWorld/MindTheWord/subscribers","subscription_url":"https://api.github.com/repos/OiWorld/MindTheWord/subscription","commits_url":"https://api.github.com/repos/OiWorld/MindTheWord/commits{/sha}","git_commits_url":"https://api.github.com/repos/OiWorld/MindTheWord/git/commits{/sha}","comments_url":"https://api.github.com/repos/OiWorld/MindTheWord/comments{/number}","issue_comment_url":"https://api.github.com/repos/OiWorld/MindTheWord/issues/comments{/number}","contents_url":"https://api.github.com/repos/OiWorld/MindTheWord/contents/{+path}","compare_url":"https://api.github.com/repos/OiWorld/MindTheWord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OiWorld/MindTheWord/merges","archive_url":"https://api.github.com/repos/OiWorld/MindTheWord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OiWorld/MindTheWord/downloads","issues_url":"https://api.github.com/repos/OiWorld/MindTheWord/issues{/number}","pulls_url":"https://api.github.com/repos/OiWorld/MindTheWord/pulls{/number}","milestones_url":"https://api.github.com/repos/OiWorld/MindTheWord/milestones{/number}","notifications_url":"https://api.github.com/repos/OiWorld/MindTheWord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OiWorld/MindTheWord/labels{/name}","releases_url":"https://api.github.com/repos/OiWorld/MindTheWord/releases{/id}","created_at":"2013-02-23T20:57:46Z","updated_at":"2015-05-03T03:18:37Z","pushed_at":"2015-05-03T13:04:00Z","git_url":"git://github.com/OiWorld/MindTheWord.git","ssh_url":"git@github.com:OiWorld/MindTheWord.git","clone_url":"https://github.com/OiWorld/MindTheWord.git","svn_url":"https://github.com/OiWorld/MindTheWord","homepage":null,"size":10844,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":21,"forks":15,"open_issues":21,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44"},"html":{"href":"https://github.com/OiWorld/MindTheWord/pull/44"},"issue":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/issues/44"},"comments":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/OiWorld/MindTheWord/statuses/360059095ff98a055af2c7c703db5ef899e3d433"}}}}