SethRobinson / UGT

Universal Game Translator - Uses Google's Cloud Vision to read and speak dialog from any image/game in any language
https://www.codedojo.com/?p=2426
Other
119 stars 24 forks source link

deepl doesn't work #56

Open Andrzejdxd opened 11 months ago

Andrzejdxd commented 11 months ago

;PlayTrans: UGT config file, read at startup. THIS FILE MUST BE RENAMED config.txt!

;To use google vision (which is required to work) you'll need your own Cloud Vision API key. (this is so google can see ;who is using it and charge you money if you hammer it too much. More info here: https://cloud.google.com/vision/docs/before-you-begin ; You need an API key, not a "Service key". To get that, ; Under "Credentials", choose "+Create Credentials" and then choose API key. See pic: https://prnt.sc/s5lc0j

;Also, visit https://console.cloud.google.com/apis/api/translate.googleapis.com and enable the Translation API. ;You also need to enable the Text To Speech API so it can talk: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com ;Note: it will use the WaveNet voices when it can for the highest quality.

;Note: Don't share your google API key! A google API key looks like (don't include quotes or anything): AIzaSyAvhMEcxpKSBD25ze06p5AlU_IuYtZ2b_g google_api_key|yourownkeygoeshere

;Optional DeepL API key. This requires that you register at deepl.com. Even if you use deepl, you ;still need the Google key above as well, as that's still used for the OCR and text to speech features. ;Note: you also need to set the "translation_engine" below to use deepl instead of google ;A deepL API key looks like (don't include quotes or anything): 263f19ba-b010-428c-77cf-cc18c977ef4b:fx deepl_api_key|462c36bd-7e4b-3xpppppppp0d926f3fb:fx

;URL to use for DeepL API calls (need to change this if you aren't using the free version of DeepL) ;If you're using the free version, use https://api-free.deepl.com ;if you're using the paid version, use https://api.deepl.com deepl_api_url|https://api-free.deepl.com

;Choose which API to use for text translations. Valid options: google, deepl. If you use deepl, you must set your API key above. ;Note: A hotkey to toggle translation engine is T, useful for comparing results ;While Deepl offers better translations, keep in mind it doesn't support as many target languages. It's missing Korean and Hindi for example and will ;give a "Unsupport target_lang" error. Works great for Japanese though. translation_engine|deepl

;Set the mode to work in.

;desktop - this allows you to translate from things you are doing on your desktop, it works with anything that ;will render to a window (emulators, webpages, etc). Won't work with full screen usually, only windowed mode.

;camera - this is my setup for capturing from live HDMI video. Designed so the output will fill a second monitor ;and be mixed with the HDMI signal later down the chain with a live luma-key effect so I can translate while playing ;on real hardware. This would allow you to translate while playing PS4 games with zero lag for example. Alternatively, desktop mode could be ;used on top of an elgato capture window or something too. ;My retro setup uses a Hydra SCART switcher with two outputs, one for the CRT and one for the OSSC to get HDMI so I can ;play on CRT but see translations on a second monitor. ; Update: These days I just use desktop mode usually, with an elgato capture card for HDMI input for PS3/etc.

;input|camera input|desktop

;when using camera mode and you have more than one camera available, you can set to id 1 or 2 etc instead of the default which is 0 ;Note: It only seems to recognize actual device driver based capture devices/cameras, Virtual Cameras like OBS's don't show up input_camera_device_id|0

;Enter a full or partial name of an audio device to use that instead. Check the log.txt for a list of them, it's ;scanned and printed there on startup. "default" means use the system default. audio_device|default

;Set to disabled and we won't call https://www.rtsoft.com/ugt/checking_for_new_version.php?version= at startup ;to see if anything newer has been released. (this check happens in the background, won't slow down the app) check_for_update_on_startup|enabled

;valid options for the below two settings (written to translation_log.txt and the clipboard): ;disabled (this means don't do anything) ;full (this means copy the pretranslated text boxes along with the translations (if any was done)) ;pre (this means only the pretranslated text) ;post (this means only the translated text, if any translation was done) log_capture_text_to_file|disabled place_capture_text_on_clipboard|disabled

;target language codes are listed here: https://cloud.google.com/translate/docs/languages ;The first language added is the default, then the rest can be dynamically changed to by using [ and ] or L and R on control pad

;If you don't want any translations done, you can make the first language added be 00|None. (just uncomment the one below this)

;add_switchable_language|00|None add_switchable_language|en|English add_switchable_language|pl|Polish

;A source language hint code (same as above) can be given to Google, this is the only way I could get it to read Punjabi. For that situation, ;you would change "auto" to "pa" below. Warning, this does BREAK most other languages though, so not recommended unless you have to. source_language_hint|auto

;Google allows you request TEXT_DETECTION or DOCUMENT_TEXT_DETECTION for the OCR phase. DOCUMENT_TEXT_DETECTION generally gives better results, ;but sometimes it lumps words from a menu together that should be separate. If you want things "split up more", try setting to TEXT_DETECTION instead. google_text_detection_command|DOCUMENT_TEXT_DETECTION

;Auto-glue is when vertical lines of text are "glued together" to be translated as a single block. Great for dialog but bad for things that shouldn't be translated together.

;set higher to auto-glue things more even when text is farther apart vertically auto_glue_vertical_tolerance|0.20

;set higher to auto-glue things more even when the next line doesn't start at the same horizontal place auto_glue_horizontal_tolerance|0.30

;When uploading the screenshot to google for scanning, 100 means perfect quality (big image) and 0 would mean horrible quality. 95 is probably good jpg_quality_for_scan|85

;Audio can be set to "fmod" or "audiere". "none" means it won't even try to initialize the audio or play any sounds. ;If this wasn't compiled with FMOD support, audiere will be used instead. (RTsoft releases will have it though) ;fmod seems slightly more compatible, audiere sometimes has weird audio crack/pops when playings mp3s generated with Google's text to speech. audio|fmod

;Valid key names: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -, =, Backspace, Tab, Q, W, E, R, T, Y, U, I, O, P, ;[, ], Enter, Ctrl, A, S, D, F, G, H, J, K, L, ;, ', `, Shift, \, Z, X, C, V, B, N, ;M, ,, ., /, Right Shift, Num *, Alt, Space, Caps Lock, F1, F2, F3, F4, F5, F6, F7, ;F8, F9, F10, Pause, Scroll Lock, Num 7, Num 8, Num 9, Num -, Num 4, Num 5, Num 6, ;Num +, Num 1, Num 2, Num 3, Num 0, Num Del, Sys Req, , \, F11, F12,

;NOTE: Set to NONE to none use that key at all

;Hotkeys can be set to require other keys down too. Not case sensitive, order doesn't matter. Example to require pressing ;Control-Alt-Shift-F12 to do something: ;hotkey_to_scan_active_window|Control,Alt,Shift,F12|

hotkey_to_scan_active_window|Control,F12| hotkey_to_scan_whole_desktop|Control,F11| hotkey_to_scan_draggable_area|Control,F10| hotkey_to_scan_last_draggable_area_again|Control,F9|

;you can also set a global gamepad button to trigger scanning the active window. This way you can scan while playing an emulator without touching the keyboard, ;or while watching video via an app showing HDMI capture or whatever. Set to "none" or blank to turn this off. ;Note: This will ONLY work if the controller is XInput compatible. (This includes XBox 360 or Xbox One controllers)

;Possible gamepad button names you can use for below: ;left action button, right action button,up action button,down action button,left shoulder button,right shoulder button ;select button,start button,left trigger button,right trigger button ;left joystick button,right joystick button, none

;Note, right joystick button means pushing down (er, in? so it clicks) on the right stick itself, not an actual button

gamepad_button_to_scan_active_window|right joystick button gamepad_button_to_scan_active_rect_window|left joystick button

;Website for kanji lookups when you left click one (the actual kanji is appended to the end of the URL) ;Leaving commented out for the default ;kanji_lookup_website|https://jisho.org/search/

////// AUDIO/SPEECH OPTIONS ///////

;If set to true, any speech currently playing is rudely cut off when the translation window is toggled off audio_stop_when_window_is_closed|false

;If a language cannot be autodetected, this language will be used when determined the voice and region to use audio_default_language|ja

////// CAMERA MODE OPTIONS //////// ;This should match what your camera/streaming device can output, if it doesn't, it will be scaled to this. Oh, the apps ;borderless window will also be set to this size ;NOTE: These are ignored in desktop mode capture_width|1920 capture_height|1080

;this lets you place the app window in a specific place, useful for putting it on your second monitor (which might be the video switcher input) window_pos_x|0 window_pos_y|0

;instead of the normal "don't show anything until space is hit", this will just show video as fast it can the whole time, ;use for seeing what your max throughput rate is and verifying the input is working show_live_video|0

;Causes the app to limit the darkest colors on the RGB channels to a minimum, this way pure black is reserved for ;the lumakeying over the live game image. (0 to 255, 0 is pure black (effectively disabling the option), 255 would force every pixel to pure white) minimum_brightness_for_lumakey|10

//////////////////////////////////////

SethRobinson commented 9 months ago

Uh... can you explain the error? Make sure you've set deepl_api_url for your appropriate key. (paid deepl key vs their free one)