No project description provided
Project description
Subtitle Translator
This Python package provides functionality to translate subtitle files from one language to another using the pysrt
and translate
modules. It includes functions to handle the translation of subtitle texts and save the results to a new file.
Installation
You can install the package using pip. To install the latest version, use:
pip install subtitle-translator
Requirements
Python 3.x pysrt translate
Usage
Import the Package
First, import the subtrans function from the subtitle_translator package:
from subtitle_translator import subtrans
Translate Subtitles
Call the subtrans function to translate a subtitle file. Provide the necessary parameters:
subtrans(file_name, from_lang, to_lang, output_name)
Parameters:
file_name (str): Path to the input subtitle file (e.g., input.srt). from_lang (str): Language code of the original subtitles (e.g., en for English). to_lang (str): Language code of the target language (e.g., es for Spanish). output_name (str): Path where the translated subtitle file will be saved (e.g., output.srt).
Example
Here’s an example of how to use the subtrans function:
from subtitle_translator import subtrans
# Translate subtitles from English to Spanish
subtrans('input.srt', 'en', 'es', 'output.srt')
In this example, the subtitles in input.srt are translated from English to Spanish and saved as output.srt.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! If you have suggestions, bug reports, or improvements, please open an issue or submit a pull request.
Contact
WhatsApp - https://whatsapp.com/channel/interniq LinkedIn - https://www.linkedin.com/interniq Telegram - https://telegram.me/interniq
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file subtranslator-0.0.2.tar.gz
.
File metadata
- Download URL: subtranslator-0.0.2.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e084aa1099dd301fc831754ebc0233bd122860035f028d54c304cac5e22dfc0f |
|
MD5 | 6a2055edd2f5665d52458eec2ff01e85 |
|
BLAKE2b-256 | 09c53ff237ec9831a3398f7dc87ce92ed49a7baffce04d1ac6b12014f4b80489 |
File details
Details for the file subtranslator-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: subtranslator-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53c8c5d718e9eecac14944fa6e095f77070519c40cc91660179074013e925347 |
|
MD5 | 32ff57fc9127e3b62f9cbb89779c5649 |
|
BLAKE2b-256 | ec5c59271342c42c8af459f8c9f577a4c67ae2ea1916367f81fd52e64a0a384e |