iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🌐

Created an HTML Tool for Multilingual Translation Locally Using LM Studio

に公開
2025/08/26

Introduction

Opportunities to use LLM services like ChatGPT and Claude for translation have increased, but they come with some limitations.

  • Inability to translate large volumes of text at once (limited tokens per request)
  • No support for epub files
  • API usage can be costly

To address these issues, I created a multilingual translation HTML tool that runs locally using LM Studio. No server is required, and everything works within the browser, making it easy to use.

Screenshot of the translation tool

Ever since plamo-2-translate, specialized for translating Plamo, was announced, I had wanted to do this, but I couldn't find the time until now (plamo-2-translate is lightweight at about 5GB, so it should run even on machines with relatively little memory).

There is still room for improvement, and the display often breaks, but please give it a try.

I recently purchased a Macbook Pro M4 Max with 128GB memory and am enthusiastically running gpt-oss-120B, finally able to leverage the machine's performance, so I plan to experiment more with local setups going forward.

Created Tool

Download

Download the latest version from 📦 LLM Translator - Release.

This tool is an HTML application that works with LM Studio's local server to translate text and epub files. Supported languages depend on the LLM model used.

Main Features

  • Completely local: Using LM Studio allows translation without an internet connection
  • Flexible language support: Supports translation between any languages supported by the LLM model
  • epub support: Upload epub files and translate chapter by chapter
  • Large text support: Processes text in chunks, enabling translation of long passages
  • Cost savings: Uses a local LLM, so no API costs are incurred

How to Use

1. Setting Up LM Studio

  1. Download and install LM Studio
  2. Download an LLM model that supports the languages you want to translate
    • Examples of Japanese-compatible models: Qwen2.5, Llama 3-ELYZA-JP-8B, etc.
    • Since supported languages vary by model, choose according to your needs
  3. Start the local server in LM Studio (default: http://localhost:1234)

2. Using the Translation Tool

  1. Download the latest ZIP file from 📦 LLM Translator - Release
  2. Extract the ZIP file
  3. Open translator.html in your browser
  4. Enter text or upload an epub file
  5. Select the target translation language
  6. Click the "Translate" button to start translation

For detailed setup and usage instructions, please refer to README.md.

The default chunk size is 1000; adjusting this changes the granularity of translation.
Increase it for larger, bulk translations, and decrease it for finer translations
(though this may affect translation accuracy or display consistency).
The optimal size depends on the model and source text, so experimentation is necessary.

Note

This tool has been tested with multiple epub files but is not completely flawless. Depending on the structure of the epub, the HTML display may break. Problems are particularly likely in the following cases:

  • epub files with complex layouts
  • epub files with special CSS styles applied
  • epub files containing many images

Technical Details

  • Frontend: Pure HTML/JavaScript (no framework used)
  • epub processing: Parses epub using JSZip and an XML parser
  • API integration: Uses LM Studio's OpenAI-compatible API endpoint
  • Translation processing: Handles large texts by splitting them into chunks

Conclusion

This tool was born out of personal needs, but I hope it can be helpful for others facing similar challenges.

If you have ideas for improvements or feature additions, please let me know via GitHub Issues or comments. I would especially appreciate feedback on the following points:

  • Ways to improve epub display issues
  • Prompt improvements to enhance translation quality
  • UI improvement suggestions
  • Ideas for other useful features

What I Really Wanted to Do

  • Properly insert images
  • Table of contents with links to corresponding sections

I look forward to hearing your opinions!

GitHubで編集を提案

Discussion