translate-server logo

translate-server

by vlinr

This is a localization translation tool based on large language models, which can automatically process and translate text content in various localization files (.ts, .js, .json). It supports batch processing and maintains the original file format.

View on GitHub

Last updated: N/A

What is translate-server?

A localization translation tool that uses large language models to automatically translate text in .ts, .js, and .json files. It handles file processing, backups, and maintains the original file structure.

How to use translate-server?

  1. Ensure your translation files include language codes in the filename (e.g., messages.en-US.ts). 2. Configure Cursor's MCP settings with your API key, model name, and base URL, using the appropriate configuration for Mac or Windows. 3. Run the tool to process the files.

Key features of translate-server

  • Supports multiple file formats (.ts, .js, .json)

  • Automatically identifies language codes in files

  • Automatically backs up original files

  • Supports batch processing of entire directories

  • Maintains source file format and structure

  • Automatic file backup

  • Error handling and logging

  • Format validation and cleaning

Use cases of translate-server

  • Localizing TypeScript applications

  • Localizing JavaScript applications

  • Localizing JSON configuration files

  • Batch translating multiple localization files

  • Automating the translation workflow

  • Maintaining consistent file structure during translation

FAQ from translate-server

What file naming conventions are supported?

The tool supports file names containing language codes in the format xx-XX (e.g., zh-CN, en-US) or xx-xx (e.g., zh-cn, en-us).

How are original files backed up?

Before processing, the tool automatically backs up the original file in the format original_filename.backup.timestamp.extension.

What happens if a file fails to process?

If a single file fails to process, it will not affect the processing of other files. Error messages will be output to the console.

How is performance optimized for large files?

Large files are automatically processed in chunks, with a default maximum of 500 key-value pairs per chunk. The tool also supports concurrent processing of multiple files to improve efficiency.

Are relative paths supported?

No, please use absolute paths. Relative paths will be resolved based on the code execution location.