If you want to use offline ai translation, you can refer to :
Translator | Supported Language number | Charge | Service | Country | Reference |
---|---|---|---|---|---|
108 | Free | Token Required | America | pygtrans | ||
Youdao | 11 | 114 | Free | Token Required | Netease | China | |
Deepl | 29 | Token Required | Deepl | Germany | |
OpenAI | 108 | Token Required | OpenAI | America | openai-python |
Alibaba | 214 | Free | damo | China | translators |
ModernMt | 200 | Free | Modernmt / Translated | Italy | translators |
Bing | 133 | Free | Modernmt / Translated | Italy | translators |
lingvanex | 109 | Free | Lingvanex | Cyprus | translators |
CloudTranslation | 8 | Free | Xiamen University / CloudTranslation | China | translators |
Caiyun | 3 | Free|Token Required | ColorfulClouds | China | translators |
Support one key translate , just select the target language and the font file and the game will be translated automatically
It's equal to the following complete tutorial
one_key_translate.mp4
complete_tutorial.mp4
The video shows in order :
- show the original game
- unpack game package
- runtime extraction (extract dialogues only)
- official extraction (equals to the extract function in official renpy-sdk)
- extraction
- replace font
- add an entrance to change langauge in preference
- translate
- show the translated game
Support pack game package based on rpatool , you can make a translation mod now
pack_game.mp4
web_translate_editor.mp4
web_brower_translate2.mp4
web_brower_translate.mp4
export_import_html.mp4
export_import_html2.mp4
export_import_html3.mp4
convert_to_html.mp4
Support format rpy files which do not cotain the original contents
You can translate the contents after format
format_rpy_files.mp4
add_entrance.mp4
extract_runtime.mp4
official_extract.mp4
unpack_game.mp4
renpy_editor.mp4
For advanced edit , it is recommended to use professional software such as EXCEL
This tool only supports loading and simple modifications
local_glossary.mp4
You should offer 2 columns :
Original : the words before replaced
Current(Replaced) : the words replaced
The first row should be the header (just for show you can rename them)
translate_files.mp4
translate_directory.mp4
replace_font_new.mp4
extract_files.mp4
extract_directories.mp4
Extract all extractable contents to tl directory and rename(if tl name is empty will just extracted to the tl directory):
extract_tl_directory_rename.mp4
As you see the above translated contents. The original contents will be remained after translation.
If the contents are short of the original contents(behind the "#" as comment) , translation will not take effect on them
The reason why I made this tool is not to replace the real translator's work , but to help.
The translated contents will be not accurate enough due to auto google | youdao | deepl translation.
So the original contents will do the effect. You can re-translate the translated contents according to the original contents. And what you modified will not be replaced during next translation.
This tool also take care of the special symbols like "{}" "[]" and "<>" in untranslated contents , for detail you can see it on the Features point 2
You can download the latest version through https://github.com/anonymousException/renpy-translator/releases/latest
-
Completely free and open-source
-
Support Editor Mode to edit file
-
Supoort local glossary to improve translation
-
Support special symbols in untranslated contents like "{}" "[]" and "<>" , the contents in special symbols will not be translated. Example:
-
# untranslated contents: # "Your name is [povname], right?" # Chinese translated: "你的名字是 [povname] ,对吗?" # Japanese translated: "あなたの名前は [povname] ですよね?"
-
Support extract the untranslated words ren'py engine has not discovered
-
Support input,brower and drag the file(s) and directory
-
Support translate/extract for single rpy file
-
Support translate/extract for all rpy files under directory
-
Support replace the fonts used by translated language
-
Support be compatible with the translated game that not translated by this translator. The translated contents before will be remained and just translate the untranslated contents
-
Support skip extract the extracted contents , need not to be worried about repeat extraction
For example , if the translation contents already exist in tl folder like :
old "Hello" new "こんにちは"
or :
# game/xxx.rpy:1352 translate japanese role_lose_7489b947: # "Hello" "こんにちは"
Then "Hello" will not be extracted again
-
Support 108 kinds of language (Default Google Translation) , you can view the google support source and the google support target
-
Support remain the original words as comments after translation
-
Support real-time log output , you can check the progress about the translation
-
Support local-proxy , if you can not access google , you can use a vpn tool like v2ray and set local proxy
-
Support multi translation engines
complete_tutorial.mp4
A good network environment , if not you may not able to translate words through the translation engine
If you can not access the translate engine, you can try use vpn tool like v2ray and set local-proxy
before:
usage:
An unpacked ren‘py game (for what you can find .rpa files under the game directory) like this:
You can try to translate the tutorial game following the tutorial
if not you can try to unpack it
I usually use UnRen-ultrahack.bat from https://f95zone.to/ to unpack the game
UnRen.mp4
It's strongly not recommended for translators to make translation through unpack and then deliver a translated version without the original author's permission. Please respect the original author
Download the UnRen-ultrahack.bat and copy it to the game directory (where game.exe locates)
Now unpack function is supported : Support unpack game through runtime hook which can bypass most encryption
The dumped file format is rpyc , so will auto call UnRen-forall(v9.4) to tranform into rpy
unpack_game.mp4
If the game is completely blend-new for you to translate , you can continue to the following contents
If the game has already been translated , you want to update the translation (translate the contents still not been translated) , you can jump to the next caption : UpdateTranslation
the first thing for the First-Translation is to extract the untranslated words from game
there are two methods to do that:
- Official Extract (extract function supported by the ren'py engine)
- Tool Extract (extract function supported by this tool)
It's recommended to use Offical Extract first and then translate the game. If you found that there still remains plenty of words not been translated after translation (Sometimes ren'py engine's official extract may miss many words). You can use the tool extract function and retranslate the game.
Offcial Extract is supported in this tool now
official_extract.mp4
you can forward to https://www.renpy.org/ and then download the latest version
Unzip the ren'py engine you download
Click "preferences" in the lower right corner
Reset the "Projects Directory" to the parent directory of the game you want to translate
Return back to the last interface and Click "Generate Translations"
Fill the "Language" , this is just a tag (It's related to the "tl name" label in this tool) used for the translation that you can name whatever you want. But it's recommended to name the target language you want to translate. Such as "japanese" or "chinese" etc.
It would be alright to keep other options default ,Especially for "Generate Translations" option , do not tick the "Generate empty strings for translations"
After all options have been set . Click the "Generate Translations" and wait to complete
And then you can close the software , the official extract is done
You can see the generated folder , remember the path
The folder path in this tutorial is :
F:\Games\RenPy\DemoGame\game\tl\japanese
extract_runtime.mp4
Runtime Extract can extract only dialogues without unpacking the game and the format is block like official
Fill (input,drag or brower) the directory that generated by Official Extract before and just tap the extract buttion , and then extraction will be done
Quite easy, right ? That's why I made this tool.
add_entrance.mp4
It's supportable to add entrance through this tool automatically
You need to add an entrance to change the language in game
Open the game directory and then enter subfolder "game", open the "screens.rpy" file (you can use notepad to open it)
Search the key words:"game_menu(_("Preferences")" (usually the words do effect if not you may need to explore what the game use to replace "Preferences")
Normally you will found many "vbox:" like this:
Try to find a vbox that contains "Language" or some other words can replace "Language"
If not found , add the following code to the file(the location next to the vbox contains "skip"):
vbox:
style_prefix "radio"
label _("Language")
textbutton "English" action Language(None)
textbutton "LanguageName" action Language("The Tag you fill in official Extract")
#such as textbutton "turn to Japanese" action Language("japanese")
Pay attention to the indentation to keep it aligned. After edit it should be like this
If found , just add a new line to the vbox:
textbutton "LanguageName" action Language("The Tag you fill in official Extract")
#such as textbutton "turn to Japanese" action Language("japanese")
After the file saved,open the game and make sure the preference show the content you just edit
replace_font_new.mp4
Before translation you need to get the font file (*.ttf or *.otf) you want to translate
The default font path is filled with your default system font which is compatible with the language you used now
For example , if you are a japanese user and your system font is japanese , the default font file can support japanese , you need not to download a japanese font from the internet to solve the garbled code problem
one_key_translate_2.mp4
For japanese, I usually use the hanazomefont
For chinese, I usally use the SourceHanSansCN
For other language , you can find relative font files using search engine easily
Open the ren'py translator and fill the following blanks
directory : the path generated during Official Extract before
font: the font file you downloaded
target : the target language you want to translate (input the letter in front of the target language to search is supportable , need not to scroll to search)
source: default Auto Detect is OK
Wait until the translation done:
So far , the translation is done , you can open game and check it :
Update-Translation is quite easy, directly use the Official Extract (optional) and Tool Extarct
After extraction , just input the directory generated during Official Extract and choose the target
As for font , if the updated game appended new special style with different font settings , you can use replace font function without font path to cover the appended special styles (font has been replaced before)
If you are willing to develop based on this project. You will need to have a python3 environment.
And install the following packages :requirements.txt
Make sure when you in Official Extract step , for "Generate Translations" option , do not tick the "Generate empty strings for translations"
The translation will only do effect when the format like this:
# game/script.rpy:553
translate schinese naming_0f7b6e71:
# r "Do name yourself like that and I'll break your face..."
r "Do name yourself like that and I'll break your face..."
or
# game/script.rpy:30886
old "Win or Lose?"
new "Win or Lose?"
Notice that the original text (behind # or old) should be the same with untranslated text (behind no # or new)
you may meet errors like this:
2024-01-30 14:55:19 D:\Download\Nova-Pasta\SunshineLoveCH2-1.01-pc\game\tl\Portugues/10_week10_00.rpy Error in line:1320
It’s [s_name]. And [y_name].
It’s [0] . And [1] .
É [0] . E 1] .
Error
It's depend on the translation result. In order to skip translate special symbols like '[]' '{}' '<>' , this tool will replace the contents in special symbols in order nums.
For example :
"It’s [s_name]. And [y_name]."
will be replaced to
"It’s [0] . And [1] ."
Normally, this format will not be translated and will remain '[0]' and '[1]' , and the tool will restore the orginal contents with the ordered nums.
However , sometimes this format may be destroyed after translation. As mentioned : "É [0] . E 1] ."
You can found that one '[' is missing , so this tool can't restore the original contents. And will not translate this line.
You may need to modify these certain lines manually.
Fortunately this situation occurs rarely , you need not to spend too much time to modify these certain lines.
Currently Google is the best choice to translate the contents which contain special symbols , you can re-translate these contents with Google
This program is packed by pyinstaller and with file operation (open read write) , so may cause false detection
If you are worried about this , you can download the source code and run the program yourself
Pyinstaller Build Version is easy to be detected as virus , it's false positive
If you are still worried about this , you can try the Nuitka verison (Nuitka.Build or RenpyTranslatorInstaller)
Release Package | Explanation | Advantage | Disadvantage |
---|---|---|---|
RenpyTranslator-Win.Pyinstaller.Build.zip | build by Pyinstaller | the executable file is single and light | may cause false positive as virus |
RenpyTranslator-Win.Nuitka.Build.zip | build by Nuitka | will not cause a false positive for most antiviruses | the executable file contain many extra support libraries |
RenpyTranslatorInstaller.exe | installer for Nuitka version | make things easier | need to install |
you may meet errors after running the translated game like this :
You can found that after translation "[[XXXX]" was translated into "[ [XXXX]" , an extra space was added (you may meet other error format but the important point is that after translation the structure of the special symbols destroyed)
The result is translated by translate engine , sometimes translation engine is not friendly to special symbols like '[]' '<>' ... especially when the special symbols used repeatedly
But there still remains good news , normally the case will not happen frequently , you only need to modify the error sentences manually (For the case mentioned above , just remove the extra space)
For special text in tooltip is actually translated but seems not work
the original code looks like this :
tooltip "this is a tooltip"
Following the tutorial from https://f95zone.to/threads/translation-of-text-in-screen.90781/
Just open the rpy file (any one under tl folder else if you can create a new one) and add the following code :
# if you choose to create a new one,you need to add the next line remove header # and relace tl_name with the directory name under tl folder like japanese
#translate tl_name strings:
old "[tooltip]"
new "[tooltip!t]"
For special text in notify is actually translated but seems not work
You need to locate the sentence on the orginal code (not the translation tl folder)
You will found the original code looks like this :
show screen notify(_("Find old Man Gibson"), None)
replace it with
show screen notify(__("Find old Man Gibson"), None)
the operation is just to add '_' after notify(
quite easy right? And then the translation will do the effect
It probably remains other case that some sentences seem not to be translated after translation
It depends on the original code , extraction may not completely covered if the original code is not quite translation-friendly
To avoid extra useless extraction , the extraction function in this tool will not extract sentences match the following style :
the length of sentences (space and special synbol will be counted as zero length) lower than 8
for example :
"I know [special symbol]"
the actual effect content is
Iknow
the length is only 5 , so it will not be extracted by the extraction from the tool
Besides the contents in ConditionSwitch() will also not be translated due to switch code may contained in it
It's normal because the target file has nothing to extract
Do not delete the 0 kb file , it is used to occupy position
Errors may occur if the file does not exist
you can view content like this after extraction
old "old:1709016761.706834_0.8853030081254853"
new "new:1709016761.706834_0.8853030081254853"
it's an unique timestamp to mark the time you extract , the format is timestamp_random (random value is to make sure the generated content is unique otherwise will cause error)
you can convert the part before '_' (in this example is 1709016761.706834) to readable time through https://www.epochconverter.com/ or other timestamp convert website
You can view your rate-limits on : rate-limits and set a reasonable limit
There are great restrictions for a new user of openai , can only post max 3 requests in per minute. almost unusable to translate
The default setting is for this situation , If you don't pay much attention to the time cost , you can try it with the default config
For higher-level user , it's recommended to turn up the setting. A suggested config is :
parameter | recommend |
---|---|
RPM(requests per minute) | 250 |
RPS(requests per second) | 10 |
TPM(requests token limits) | rate-limits |
model | gpt-3.5-turbo | gpt-4 (smarter but slower and more expensive) |
OpenAI seems not to be friendly to special symbols like '{}' '[]' , you may meet errors mentioned before : Some errors made it impossible to translate certain lines
You can re-translate the error lines with google engine (translated lines will be auto skipped , just re-translate the full directory or file(s) translated before)
(Google translation is more friendly to the special symbols but may still remain few errors)
At last you need to modify the remained few error lines manually
Besides if you meet traceback errors in openai , try to disable the option Multi-Translate and re-translate (it's more stable but slower).
And you may meet errors like this:
2024-02-22 11:18:28 Traceback (most recent call last):
File "openai_translate.py", line 180, in translate_limit
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 353, in raw_decode
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 1613 (char 1612)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "openai_translate.py", line 187, in translate_limit
Exception: Unterminated string starting at: line 1 column 1613 (char 1612)
It's due to the error format data returned by openai , fortunately this will not happened frequently and will only cause partially untranslated in one file. You can re-translate the untranslated lines with other translation engine such as google translation
You may meet errors like this:
2024-02-23 10:19:34 translated result can not match the untranslated contents
The reason is that openai may merge multi-translation result occasionally , such as:
#untranslated
["Hello","Good"]
#translated
["こんにちは,良い"]
This can lead to mismatching of translations , so the partial translation will not do effect , you may need to translate the untranslated lines with other translation engine
You may meet errors like this:
2024-02-23 10:19:34 Another non-200-range status code was received:400 <Response [400 Bad Request]>
2024-02-23 10:19:34 Error code: 400 - {'error': {'message': 'Connection error (request id: 20240223101928248984704uoEfBgvh)', 'type': '', 'param': '', 'code': 'connection_error'}}
2024-02-23 10:19:34 ['untranslated1','untranslated2','....']
It's depend on your network environment , re-translate may do effect
You can write a python script which supports translation api , and import it to this tool
you should write like caiyun.py and baidu.py (the api name must be tranlate_single or tranlate_queue)
besides you should offer two language files for source and target like caiyun.source.rst and caiyun.target.rst
A good example setting looks like this: