explaingit

hillya51/lunatranslator

11,480C++Audience · generalComplexity · 3/5LicenseSetup · moderate

TLDR

A Windows app that translates visual novel text in real time while you play, using game hooking or OCR to capture text and routing it through your choice of translation engine.

Mindmap

mindmap
  root((LunaTranslator))
    Text Capture
      Game hook
      OCR engine
      Emulator hook
    Translation
      LLM APIs
      Machine translation
      Offline engines
    Extra Features
      Anki flashcards
      Text to speech
      Embedded text
    Supported Platforms
      PC visual novels
      Switch emulator
      PSP and PS2
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Play a Japanese visual novel with a live translation overlay without waiting for a fan translation patch.

USE CASE 2

Read emulated Nintendo Switch, PSP, or PS2 games with translated text captured from the emulator.

USE CASE 3

Study Japanese vocabulary while playing by using word segmentation and Anki flashcard export.

USE CASE 4

Have translated dialogue spoken aloud using text-to-speech while reading along.

Tech stack

C++WindowsPython

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Windows. Translation quality depends on the engine you configure, some engines require API keys from external services.

Free to use and share, but any software you distribute that includes this code must also be released as open source under the same GPL license.

In plain English

LunaTranslator is a Windows desktop application for translating text from visual novels in real time. It is aimed at players who want to read Japanese visual novels (or games in other languages) while having a translation displayed alongside the game, without needing to modify game files or wait for fan translation patches. The primary method for extracting text is HOOK, a technique that intercepts the game's text output at the system level. The README states this is compatible with nearly all common and obscure visual novel titles. For games running on emulators covering Nintendo Switch, PSP, Vita, and PS2, LunaTranslator can hook directly into the emulator to read text without running the game natively on PC. For games where HOOK does not work, LunaTranslator includes OCR support with a built-in high-precision model, and connections to many additional online and offline OCR engines. Once text is captured by any method, it can be routed to a wide range of translation engines, including large language model APIs, offline translation tools, and conventional machine translation services. Additional features include embedded translation (injecting the translated text directly into the game display for a more immersive experience), Japanese word segmentation with kana pronunciation annotation for language learners, integration with Anki for vocabulary study via AnkiConnect, text-to-speech output through multiple engines, and speech recognition on Windows 10 and Windows 11. The software is licensed under GPLv3 and the project accepts sponsorships via Patreon.

Copy-paste prompts

Prompt 1
I want to play a Japanese visual novel on PC with LunaTranslator. Walk me through setting up the HOOK text extraction and connecting it to a translation engine.
Prompt 2
The visual novel I am playing does not work with LunaTranslator's hook method. How do I set up OCR mode to capture text from the screen instead?
Prompt 3
I am playing a PS2 game in an emulator and want LunaTranslator to translate the text. How do I connect it to the emulator?
Prompt 4
How do I set up LunaTranslator to send new Japanese words to Anki automatically using AnkiConnect so I can review them later?
Prompt 5
Configure LunaTranslator to inject the translated text directly into the game window instead of showing it in a separate overlay panel.
Open on GitHub → Explain another repo

← hillya51 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.