Dark_EccentricYT

Untitled

Nov 2nd, 2020 (edited)
15,733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. local HttpService = game:GetService("HttpService")
  2. local Players = game:GetService("Players")
  3.  
  4. ChatMode = "private"
  5. DeviceSpoofing = "Redmi Note 8 Pro"
  6.  
  7. local source_languages = {
  8. ["de"]=true,
  9. ["ru"]=true,
  10. ["fr"]=true,
  11. ["es"]=true,
  12. ["tr"]=true,
  13. ["ja"]=true,
  14. ["no"]=true,
  15. ["ro"]=true,
  16. ["pt"]=true,
  17. ["zh"]=true,
  18. ["ko"]=true,
  19. ["ar"]=true,
  20. ["sq"]=true,
  21. ["it"]=true,
  22. ["el"]=true,
  23. ["vi"]=true,
  24. ["he"]=true,
  25. ["da"]=true,
  26. ["pl"]=true,
  27. ["sv"]=true
  28. }
  29.  
  30. local blacklisted_words = {
  31. ["axe"]=true
  32. }
  33.  
  34.  
  35. local blacklisted_players = {
  36. ["mk15ru6l3g"]=true,
  37. ["Loostys"]=true,
  38. ["vintaqeo"]=true
  39. }
  40.  
  41.  
  42. game:GetService("StarterGui"):SetCore("SendNotification", {
  43. Title = "In-Line ChatTranslator";
  44. Text = "Loaded";
  45. Duration = 5;
  46. })
  47.  
  48. Translate = function(plr)
  49. plr.Chatted:Connect(function(Message)
  50.  
  51. local detect_lan = syn.request({["Url"] = 'https://translate.yandex.net/api/v1/tr.json/translate?srv=android&lang=en&text='..HttpService:UrlEncode(Message),["Headers"] = {["User-Agent"] = "Mozilla/5.0 (Linux; Android 10; "..DeviceSpoofing..") AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Mobile Safari/537.36",["Accept-Charset"] = "utf-8"}})
  52. local translate = detect_lan.Body
  53. local decoded = HttpService:JSONDecode(translate)
  54.  
  55. local detect_lan_fixed = decoded.lang:split("-")
  56.  
  57. if Message:sub(1,2) == "/e" or Message:sub(1,2) == "/w" or Message:sub(1,2) == "/t" and not plr.Name == game.Players.LocalPlayer.Name then
  58.  
  59. else
  60. if source_languages[detect_lan_fixed[1]] and not blacklisted_words[Message] and not blacklisted_players[plr.Name] then
  61.  
  62. if detect_lan_fixed[1] == "de" then
  63. detect_lan_fixed[1] = "German"
  64. elseif detect_lan_fixed[1] == "ru" then
  65. detect_lan_fixed[1] = "Russian"
  66. elseif detect_lan_fixed[1] == "fr" then
  67. detect_lan_fixed[1] = "French"
  68. elseif detect_lan_fixed[1] == "es" then
  69. detect_lan_fixed[1] = "Spanish"
  70. elseif detect_lan_fixed[1] == "tr" then
  71. detect_lan_fixed[1] = "Turkish"
  72. elseif detect_lan_fixed[1] == "ja" then
  73. detect_lan_fixed[1] = "Japanese"
  74. elseif detect_lan_fixed[1] == "no" then
  75. detect_lan_fixed[1] = "Norwegian"
  76. elseif detect_lan_fixed[1] == "ro" then
  77. detect_lan_fixed[1] = "Romanian"
  78. elseif detect_lan_fixed[1] == "pt" then
  79. detect_lan_fixed[1] = "Portuguese"
  80. elseif detect_lan_fixed[1] == "zh" then
  81. detect_lan_fixed[1] = "Chinese"
  82. elseif detect_lan_fixed[1] == "ko" then
  83. detect_lan_fixed[1] = "Korean"
  84. elseif detect_lan_fixed[1] == "ar" then
  85. detect_lan_fixed[1] = "Arabic"
  86. elseif detect_lan_fixed[1] == "sq" then
  87. detect_lan_fixed[1] = "Albanian"
  88. elseif detect_lan_fixed[1] == "it" then
  89. detect_lan_fixed[1] = "Italian"
  90. elseif detect_lan_fixed[1] == "el" then
  91. detect_lan_fixed[1] = "Greek"
  92. elseif detect_lan_fixed[1] == "vi" then
  93. detect_lan_fixed[1] = "Vietnamese"
  94. elseif detect_lan_fixed[1] == "he" then
  95. detect_lan_fixed[1] = "Hebrew"
  96. elseif detect_lan_fixed[1] == "da" then
  97. detect_lan_fixed[1] = "Danish"
  98. elseif detect_lan_fixed[1] == "pl" then
  99. detect_lan_fixed[1] = "Polish"
  100. elseif detect_lan_fixed[1] == "sv" then
  101. detect_lan_fixed[1] = "Swedish"
  102. end
  103.  
  104.  
  105. local response = syn.request({["Url"] = 'https://translate.google.com/m?hl=en&sl=auto&tl=en&ie=UTF-8&prev=_m&q='..HttpService:UrlEncode(Message),["Headers"] = {["Accept-Charset"] = "utf-8"}})
  106. local translate = response.Body
  107.  
  108. local t_start = tonumber(translate:find('class="t0"')+11)
  109. local t_end = translate:find('class="blue ub db center"')
  110. local trimmed = translate:sub(t_start, t_end)
  111. local trimmed_end = trimmed:find("</div>") --trimmed end
  112. local trimmed_final_len = trimmed:sub(trimmed_end):len()
  113.  
  114. local fixed_translate_end = translate:sub(t_start, t_end-trimmed_final_len) --Translated message
  115.  
  116. if ChatMode == "private" then
  117. game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
  118. Text = "["..plr.Name.."] ["..detect_lan_fixed[1].."]"..": "..fixed_translate_end:gsub("(&#39;)", "'"):gsub("(&quot;)", '"'),
  119. Color = Color3.new(1, 0, 0)
  120. })
  121. elseif ChatMode == "public" then
  122. local A_1 = "["..plr.Name.."] ["..detect_lan_fixed[1].."]"..": "..fixed_translate_end:gsub("(&#39;)", "'"):gsub("(&quot;)", '"')
  123. local A_2 = "All"
  124. local Event = game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest
  125. Event:FireServer(A_1, A_2)
  126. end
  127.  
  128. end
  129. end
  130.  
  131. if Message:sub(1,2) == "/e" and plr.Name == game.Players.LocalPlayer.Name then
  132. local target_lan = Message:sub(4, 5, #Message)
  133. local tMessage = Message:sub(7, #Message)
  134.  
  135. local response = syn.request({["Url"] = 'https://translate.google.com/m?hl=en&sl=auto&tl='..target_lan..'&ie=UTF-8&prev=_m&q='..HttpService:UrlEncode(tMessage),["Headers"] = {["Accept-Charset"] = "utf-8"}})
  136. local translate = response.Body
  137.  
  138. local t_start = tonumber(translate:find('class="t0"')+11)
  139. local t_end = translate:find('class="blue ub db center"')
  140. local trimmed = translate:sub(t_start, t_end)
  141. local trimmed_end = trimmed:find("</div>") --trimmed end
  142. local trimmed_final_len = trimmed:sub(trimmed_end):len()
  143.  
  144. local fixed_translate_end = translate:sub(t_start, t_end-trimmed_final_len) --Translated message
  145.  
  146.  
  147. local A_1 = fixed_translate_end:gsub("(&#39;)", "'"):gsub("(&quot;)", '"')
  148. local A_2 = "All"
  149. local Event = game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest
  150. Event:FireServer(A_1, A_2)
  151. end
  152.  
  153. end)
  154.  
  155. end
  156.  
  157. for _, plr in pairs(game.Players:GetChildren()) do
  158. Translate(plr)
  159. end
  160.  
  161. game.Players.PlayerAdded:connect(function(player)
  162. Translate(player)
  163. end)
Add Comment
Please, Sign In to add comment