- Jul 25, 2017
- 272
- 66
Have you gotten devokin's code to work? If so can you share your devokin's files?I think you're mixing a couple of things here, but congrats on getting it working somehow!
Textractor is it's own tool that hooks into games to translate what it finds.
Sugoi Autotranslator is a translator we use here to translate stuff without needing internet. You CAN hook it up to textractor or translator++, but they work without it (and probably better too).
Translator++ is yet another tool to dig through (mostly RPG Maker) games and find text which then makes you able to translate it before putting it back together (either by hand or using sugoi autotranslator, or something else like google, bing, yandex, ...). This one doesn't work well here since Translator++ doesn't know the game engine used here.
The way i programmed it, it's supposed to show the translation outside of the game, so it doesn't lag. That's why in the file src/Window_BattleMessage.rb & src/Window_Message the translate-function is defined with "new Thead"
That's why I said using textractor does the same thing.Code:require 'net/http' require 'json' require 'uri' def translate(text) Thread.new do uri = URI('http://localhost:14366/') Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') request.body = {message:"translate sentences",content:text}.to_json response = http.request request return response.body end end end
If you want to see it in game (which will cause massive lag) you'll need to copy-paste devokin's code into the files. Just overwrite the functions with what he wrote (it's 4 functions in total, 2 in each file). The add_message functions here are used by the game to display some text, we just hooked up a translate function into it to get us the translation.
edit: also for context: sugoi autotranslator offline mode (which is used here) hosts its own server locally for your machine. that's why the HTTP.start stuff is being done in the code. The idea was to prevent lag by having to wait for calls over the internet, which might not respond with a translation, but a rejection. Turns out it's too slow though
edit2: also, just in case you got it mixed up, notepad++ is just a better text-editor, nothing to do with translations.
I cannot get the english text to appear in the game which was my goal. Do you think the lag makes it unplayable? If its really bad lag, i guess its not worth it.
I already am able to display english outside the game using translation aggregator so i never really got excited about that.