anonymousException/renpy-translator

Use the game's built-in export translation to resolve version compatibility issues

wqerrewetw opened this issue · 3 comments

Use the game's built-in export translation to resolve version compatibility issues

https://www.renpy.org/doc/html/cli.html

usage: xxx.py [--savedir DIRECTORY] [--trace LEVEL] [--version] [--compile] [--keep-orphan-rpyc]
                       [--errors-in-editor] [--safe-mode] [--json-dump FILE] [--json-dump-private] [--json-dump-common]
                       [-h] [--profile-display] [--debug-image-cache] [--warp WARP]
                       [basedir] [command]

The Ren'Py visual novel engine.

positional arguments:
  basedir              The base directory containing of the project to run. This defaults to the directory containing
                       the Ren'Py executable.
  command              The command to execute. Available commands are: add_from, compile, dialogue, director,
                       extract_strings, gui_images, lint, merge_strings, quit, rmpersistent, run, test, translate,
                       update. Defaults to 'run'.

optional arguments:
  --savedir DIRECTORY  The directory where saves and persistent data are placed.
  --trace LEVEL        The level of trace Ren'Py will log to trace.txt. (1=per-call, 2=per-line)
  --version            Displays the version of Ren'Py in use.
  --compile            Forces all .rpy scripts to be recompiled before proceeding.
  --keep-orphan-rpyc   Prevents the compile command from deleting orphan rpyc files.
  --errors-in-editor   Causes errors to open in a text editor.
  --safe-mode          Forces Ren'Py to start in safe mode, allowing the player to configure graphics.
  -h, --help           Displays this help message, then exits.

JSON dump arguments:
  Ren'Py can dump information about the game to a JSON file. These options let you select the file, and choose what
  is dumped.

  --json-dump FILE     The name of the JSON file.
  --json-dump-private  Include private names. (Names beginning with _.)
  --json-dump-common   Include names defined in the common directory.

run command arguments:
  Runs the current project normally.

  --profile-display    If present, Ren'Py will report the amount of time it takes to draw the screen.
  --debug-image-cache  If present, Ren'Py will log information regarding the contents of the image cache.
  --warp WARP          This takes as an argument a filename:linenumber pair, and tries to warp to the statement before
                       that line number.

[basedir]\\lib\\py3-windows-x86_64\\python.exe xxx.py "[basedir]" translate targetLanguage

@echo off

if exist "lib\windows-x86_64\python.exe" (
	if not "%PROCESSOR_ARCHITECTURE%"=="x86" (
		set "pyPath=%cd%\lib\windows-x86_64\"
	) else if exist "lib\windows-i686\python.exe" (
		set "pyPath=%cd%\lib\windows-i686\"
	)
) else if exist "lib\windows-i686\python.exe" (
	set "pyPath=%cd%\lib\windows-i686\"
)
if exist "lib\py2-windows-x86_64\python.exe" (
	if not "%PROCESSOR_ARCHITECTURE%"=="x86" (
		set "pyPath=%cd%\lib\py2-windows-x86_64\"
    ) else if exist "lib\py2-windows-i686\python.exe" (
		set "pyPath=%cd%\lib\py2-windows-i686\"
	)
) else if exist "lib\py2-windows-i686\python.exe" (
	set "pyPath=%cd%\lib\py2-windows-i686\"
)
if exist "lib\py3-windows-x86_64\python.exe" (
	if not "%PROCESSOR_ARCHITECTURE%"=="x86" (
		set "pyPath=%cd%\lib\py3-windows-x86_64\"
    ) else if exist "lib\py3-windows-i686\python.exe" (
		set "pyPath=%cd%\lib\py3-windows-i686\"
	)
) else if exist "lib\py3-windows-i686\python.exe" (
	set "pyPath=%cd%\lib\py3-windows-i686\"
)


set pyFile=""
for  %%s in ("*.exe") do (
	if exist "%%~ns%.py" (
		set "pyFile=%%~ns%.py"
	)
	
)

if not exist "%pyFile%" (
	echo "python file not found"
	pause>nul|set/p=.�Press any key to exit...
	exit
)

set /p tl=Enter the target language(default:english):

IF [%tl%] == [] (set "tl=english")

"%pyPath%python.exe" "%pyFile%"  "%cd%" translate %tl%
pause

Thanks for your suggestion. I will try to import this in feature version

Thanks for your suggestion , already supported in v2.0.9