Metadata-Version: 2.4
Name: argos-translate-files-main
Version: 1.4.2
Summary: Translate files with Argos Translate
Home-page: https://github.com/LibreTranslate/argos-translate-files
Author: S. Thuret
Author-email: contact@sebastien-thuret.fr
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: beautifulsoup4>=4.9.3
Requires-Dist: lxml>=4.9.2
Requires-Dist: argostranslatemain==1.9.6
Requires-Dist: translatehtml>=1.5.1
Requires-Dist: pysrt>=1.1.2
Requires-Dist: PyMuPDF>=1.24.11
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Argos Translate Files

Translate files using [Argos Translate](https://github.com/argosopentech/argos-translate).

## Supported file format

.txt, .odt, .odp, .docx, .pptx, .epub, .html, .srt

## Install

```
pip install argos-translate-files
```


## Example

```python
import os.path

import argostranslate.package, argostranslate.translate


import argostranslatefiles
from argostranslatefiles import argostranslatefiles

from_code = "fr"
to_code = "en"

installed_languages = argostranslate.translate.get_installed_languages()
from_lang = list(filter(
    lambda x: x.code == from_code,
    installed_languages))[0]
to_lang = list(filter(
    lambda x: x.code == to_code,
    installed_languages))[0]
underlying_translation = from_lang.get_translation(to_lang)

argostranslatefiles.translate_file(underlying_translation, os.path.abspath('path/to/file.txt'))

```
