A tool that lets you translate various lyric files. Originally created for use with Kikoeru but adjusted to work with any folder structure.
- Download the latest release from here and extract it.
- The correct file is named
translate-lrc.zip.
- The correct file is named
- Open the
.envfile in notepad and adjust the settings as necessary.- See Configuration for more details on the
.envfile
- See Configuration for more details on the
- Save your changes and close the file
- Place the files you want to translate in the
queuefolder (or whatever folder you set in the.envfile) - Run
translate.exe - Translated files will be placed in the
outputfolder by default
To adjust the configuration, you will need to create a .env file in the same directory by creating a copy of the .env.example file.
TRANSLATOR- The translation method to use. The available options are:LLM- For any OpenAI API-compatible endpoint. Examples include OpenRouter, llama.cpp, Ollama, LMStudio, etc.DEEPL- For DeepLLIBRE- For LibreTranslateLUNA- For LunaTranslator
RJ_PATH- The location of the folder that contains all of your lyric/subtitle files that need to be translated. This path will be searched recursively. Defaults to./queuein the same directory if not provided.BAK_PATH- The location of the folder where you want a backup of your lyric/subtitle files to be stored. Defaults to./backupin the same directory if not provided.OUT_PATH- The location of the folder where you want your translated lyric/subtitle files to be stored. The folder structure of the files will be the same structure as theRJ_PATHfolder. Defaults to./outputin the same directory if not provided.
These configuration items only apply if your TRANSLATOR is set to LLM:
LLM_ENDPOINT- Required. The Chat Completions URL. Must be OpenAI API-compatible.LLM_API_KEY- The API Key or other Bearer auth token to used for authenticaing with the LLM service. Can be removed if you are running an LLM locally.LLM_MODEL- The model to use for the translation. If this is not included, it will used the already-loaded model (local-only).
You can also override the parameters used for the LLM:
LLM_PARAM_PROMPT- The system prompt to use for the translation. To improve accuracy, your system prompt should include the desired source and target language.LLM_PARAM_TEMPERATURE- TemperatureLLM_PARAM_TOP_P- Top-PLLM_PARAM_TOP_K- Top-KLLM_PARAM_REPETITION_PENALTY- Repetition Penalty
These configuration items only apply if your TRANSLATOR is set to DEEPL:
DEEPL_API_KEY- Required. The DeepL API Key. Requires a DeepL account, but creating your own key is free. You can find more information here.DEEPL_SOURCE_LANG- The source language code you want to translate from. If it is unknown or you would prefer to have DeepL auto-detect it, you can delete this entirely. See this article for a list of supported language codes.DEEPL_TARGET_LANG- The target language code you want to translate to. Defaults toen-USif not provided. See this article for a list of supported language codes.
These configuration items only apply if your TRANSLATOR is set to LIBRE:
LIBRE_ENDPOINT- The endpoint which is hosting your LibreTranslate instance.LIBRE_SOURCE_LANG- The source language code you want to translate from. If it is unknown or you would prefer to have it auto-detected, you can delete this entirely. See this page for a list of supported language codes.LIBRE_TARGET_LANG- The target language code you want to translate to. Defaults toenif not provided. See this page for a list of supported language codes.
These configuration items only apply if your TRANSLATOR is set to LUNA:
LUNA_ENDPOINT- The endpoint which is hosting your LibreTranslate instance.LUNA_TRANSLATOR- The name of the translator to use within LunaTranslator. You must configure the translators yourself within LunaTranslator. You can visit the/api/list/translatorendpoint of your server to get a list of translator names.
This project requires deno to run.
deno install- Copy
.env.exampleto.env - Edit
.envand adjust settings as necessary.- See Configuration for more details on the
.envfile
- See Configuration for more details on the
- Place your files/folders with untranslated subtitles in your
RJ_PATH(queue) folder deno task translate
deno task translate- The main task. Translates lyrics/subtitles as specified in this README.deno task deepl-tlfix- Useful for re-translating or fixing a cache file that may have been translated incorrectly by DeepL. For example, if automatic language detection is enabled, but DeepL selected the wrong language. To use:- Copy the bad
data/tlcache.jsontodata/tlfix.json - Strip the file so that only the entries you want to retranslate are there
- Replace
detectedSourceLangwith the correct language code - Run the script. The translated file will be saved to
data/tlfix-translated.json
- Copy the bad