Metadata-Version: 2.4
Name: gettext-translator-marianmt
Version: 0.1.1
Summary: MarianMT (Helsinki-NLP) local backend for gettext-translator
Author-email: Rodolfo González González <code@rodolfo.gg>
License-Expression: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/rgglez/gettext-translator
Project-URL: Issues, https://github.com/rgglez/gettext-translator/issues
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.LESSER
Requires-Dist: gettext-translator-service<0.2,>=0.1
Requires-Dist: transformers>=5.6.2
Requires-Dist: torch>=2.11.0
Requires-Dist: sentencepiece
Dynamic: license-file

# gettext-translator-marianmt

MarianMT backend for [gettext-translator](https://github.com/rgglez/gettext-translator).

## Usage from gettext-translator

```bash
gettext-translator --backend marianmt --src en --dst zh_CN --po ../../example/messages.po
```

This command translates the `messages.po` file from English into Simplified Chinese from China (zh_CN), using the [Helsinki-NLP OPUS multilingual](https://huggingface.co/Helsinki-NLP) models processing 100 translations per batch. This plugin runs locally.

## Configuration

None for the moment.

## Installation

```bash
pip install "gettext-translator[marianmt]"
```

## Notes

- Plural forms: this backend translates the singular and the plural `msgid` separately and uses the plural translation for every form except the first one. That is right for languages with two plural forms; for languages with more (Russian, Polish, Arabic...) use an LLM backend.
* You might need to get a token from HuggingFace and set this environment variable in order to avoid limits:

```bash
export HF_TOKEN=hf_xxxxxxxxxxxxxxxxx
```

## License

Copyright (C) 2026 Rodolfo González González.

Licensed under [LGPL 3.0 or later](https://www.gnu.org/licenses/lgpl-3.0.html).
