Skip to content

mddanish00/stas-ln-translator

Repository files navigation

stas-ln-translator

Alternative standalone Light Novel translator for Sugoi Translator.

GitHub License GitHub Workflow Status Buy Me A Coffee Ko-fi

stas-ln-translator name is an abbreviation of Sugoi Translator Alternative Standalone Light Novel Translator.

Some parts of this program are based on Light-Novel-EPUB-Translator, which is included in Sugoi Translator.

Not affiliated with Sugoi Translator.

Features

  • Fast because API requests to the Server are handled concurrently.
  • Batch mode is used by default to cut down the number of requests needed significantly.
  • stas-server as a first-class citizen with compatibility with Sugoi Translator.
  • Standalone, not tightly coupled like Light-Novel-EPUB-Translator.

User Guide

Requirements

  • stas-server or Sugoi Offline Translator (only request_type=Single can be used).

  • Python 3.12 - 3.14. Python 3.15 and later are not yet supported.

Installation

This project is not intended as a library, so installation through uv is recommended.

It is recommended to use my Python Package Index for as shown as below to install this package.

You can also directly download the wheel in the Releases and install the package.

uv tool install stas-ln-translator --index https://mddanish00.github.io/python-index/simple

Upgrade

uv tool upgrade stas-ln-translator

Running Program

For the best experience with this program, you can use Sigil to clean up input EPUB files first. Try some of these.

  • Tools > Reformat HTML > Mend and Prettify All HTML Files
  • Tools > Restructure Epub to Sigil Norm
  • Tools > Epub3 Tools > Generate NCX/Guide for Epub2 readers
usage: stas-ln-translator [-h] [-v] [--batch_size BATCH_SIZE] [--request_type {Single,Batch}]
                          [--tag_to_translate TAG_TO_TRANSLATE]
                          [--translator_api_url TRANSLATOR_API_URL] [--overwrite]
                          input output

Run stas-ln-translator, an alternative standalone Light Novel translator for Sugoi Translator.
Recommended usage with stas-server.

positional arguments:
  input                 Input EPUB file.
  output                Output EPUB file.

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  --batch_size BATCH_SIZE
                        Number of lines per batch in a request. Batch request type only. (default:
                        100)
  --request_type {Single,Batch}
                        Request type used when contacting API. Either 'Single' or 'Batch'.
                        (default: Batch)
  --tag_to_translate TAG_TO_TRANSLATE
                        HTML elements to translate, separated by commas. (default:
                        p,h1,h2,h3,h4,h5,h6,title)
  --translator_api_url TRANSLATOR_API_URL
                        stas-server or any other Sugoi Translator compatible API URL. (default:
                        http://localhost:14366)
  --overwrite           Overwrite output file if it already exists. (default: False)

Options

Name Default Description
batch_size 100 Number of lines per batch in a request.
request_type Batch Request type used when contacting the API. Either Single or Batch.
tag_to_translate p,h1,h2,h3,h4,h5,h6,title HTML elements to translate, separated by commas.
translator_api_url http://localhost:14366 stas-server or any other Sugoi Translator compatible API URL.

Development

This project is developed using the latest Python and managed by uv.

To start developing for this project, make sure to install uv. It will automatically download uv-managed Python if your system Python is not 3.13. It will not clash with your system Python because it is only used for this project.

Refer to uv official docs for the installation instructions.

Initialise the virtual environment and install dependencies.

uv sync

Launch and test the server.

uv run stas-ln-translator

Build the project wheel.

uv build --wheel

Like this project?

Star this project if it is useful for you.

Also, consider buying me a coffee!

ko-fi

"Buy Me A Coffee"

License

This project is licensed under the MIT license.

Other License

Light-Novel-EPUB-Translator project is part of the Sugoi Japanese Toolkit and is licensed under the MIT license.

Acknowledgement

  • Thanks to MingShiba for creating the Sugoi Japanese Toolkit and making high-quality (still machine translation) available to enjoy many untranslated Japanese works.

About

An alternative standalone Light Novel translator for Sugoi Translator.

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE-Light-Novel-EPUB-Translator

Stars

Watchers

Forks

Sponsor this project

Contributors

Languages