Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Latest commit

 

History

History
74 lines (48 loc) · 2.15 KB

README.md

File metadata and controls

74 lines (48 loc) · 2.15 KB

AutoTranslate

AutoTranslate is a Python script designed to automatically translate text files. It uses the Google Translate API to perform translations between multiple languages, facilitating content localization for different users.

Table of Contents

Features

  • Bulk text translation from text files.
  • Support for multiple languages via Google Translate.
  • Automatically ignore non-translatable content (identifiers, media files, etc.).
  • Display progress status for the translation process.
  • Handle special sequences to preserve formatting.

Installation

You can clone this repository and install the necessary dependencies:

git clone https://github.com/Felzow47/Autotranslate.git
cd Autotranslate
pip install deep_translator

Usage

Make sure to include the directory containing the files to be translated:

directory = 'path/to/folder'

Changing the Source and Target Languages

To customize the translation language, modify the values of the source_lang and target_lang parameters in the translate_text_in_code function according to your needs.

Available Languages

To know the languages supported by the Google API, consult the list of available languages.

Function Example

Here's how to define the source and target languages in the code:

def translate_text_in_code(file_path, source_lang='en', target_lang='fr'):

Examples

To translate Ren'Py games using .rpy files, simply modify the extension searched for in the script. For example, replace the following line:

if filename.endswith('.rpy'):

Contributions

Feel free to fork the project and contribute as you wish! Your ideas and improvements are welcome.

License

This project is under free license, so feel free to use it