Metadata-Version: 2.4
Name: fastapi-rosetta
Version: 0.1.2
Summary: A FastAPI-native translation management interface for gettext translation files.
Project-URL: Homepage, https://github.com/rezatn0934/fastapi-rosetta
Project-URL: Repository, https://github.com/rezatn0934/fastapi-rosetta
Author-email: Reza Teymouri Nejad <rezatn0934@gmail.com>
License: MIT
License-File: LICENSE
Keywords: fastapi,gettext,i18n,internationalization,rosetta,translation
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.133.1
Requires-Dist: jinja2>=3.1.6
Requires-Dist: polib>=1.2.0
Requires-Dist: pydantic>=2.13.4
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: requests>=2.34.2
Provides-Extra: google
Requires-Dist: google-cloud-translate>=3.27.0; extra == 'google'
Provides-Extra: openai
Requires-Dist: openai>=2.53.0; extra == 'openai'
Description-Content-Type: text/markdown

# FastAPI Rosetta

A modern translation management interface for **FastAPI** applications using GNU gettext (`.po`) files.

FastAPI Rosetta lets translators and developers edit, search, and manage translation files directly from a clean web interface—without relying on Django.

![FastAPI Rosetta](https://raw.githubusercontent.com/rezatn0934/fastapi-rosetta/main/docs/images/editor.png)
---

## Features

* 🌍 Browse all translation files from one place
* ✏️ Edit translations directly in your browser
* 🔍 Search messages instantly
* 🏷️ Filter translated, untranslated, or fuzzy entries
* 🌐 Support multiple languages
* 🔄 Reference another language while translating
* 🤖 Machine translation support (Google Cloud & OpenAI)
* 📦 Download translations as ZIP files
* ⚡ Automatically compile `.mo` files after saving
* 🎨 Lightweight, FastAPI-native interface

---

## Installation

Install the package:

```bash
uv add fastapi-rosetta
```

Or using pip:

```bash
pip install fastapi-rosetta
```

### Optional translation providers

Google Cloud

```bash
uv add "fastapi-rosetta[google]"
```

OpenAI

```bash
uv add "fastapi-rosetta[openai]"
```

Both

```bash
uv add "fastapi-rosetta[google,openai]"
```

---

## Quick Start

```python
from pathlib import Path

from fastapi import FastAPI


from fastapi_rosetta import RosettaConfig, configure, mount_static
from fastapi_rosetta import router as rosetta_router

app = FastAPI()

BASE_DIR = Path(__file__).resolve().parent

configure(
    RosettaConfig(
        requires_auth=True,
        locale_paths=(
            str(BASE_DIR / "locales"),
        ),
        languages=(
            ("fa", "Persian"),
            ("en", "English"),
        ),
        messages_per_page=20,
    )
)

app.include_router(rosetta_router)

mount_static(app)
```

Start your application:

```bash
uvicorn main:app --reload
```

Then open:

```
http://localhost:8000/rosetta/
```

---

## Translation Files

FastAPI Rosetta works with standard GNU gettext files.

Example directory structure:

```text
locale/
├── en/
│   └── LC_MESSAGES/
│       ├── messages.po
│       └── messages.mo
│
├── fa/
│   └── LC_MESSAGES/
│       ├── messages.po
│       └── messages.mo
│
└── de/
    └── LC_MESSAGES/
        ├── messages.po
        └── messages.mo
```

---

## Typical Workflow

1. Open the Rosetta interface.
2. Select a language.
3. Choose a translation file.
4. Search or browse messages.
5. Edit translations.
6. Save your changes.
7. Download the updated translation files if needed.

---

## Use Cases

FastAPI Rosetta is suitable for:

* SaaS applications
* Admin dashboards
* Business applications
* Multi-language websites
* APIs with translated content
* Open-source projects
* Internal company tools
* FastAPI microservices

---

## Machine Translation

FastAPI Rosetta can suggest translations using supported providers.

Currently supported:

* Google Cloud Translation
* OpenAI

These providers are optional and can be installed only when needed.

---

## Screenshots

### Translation Editor

![Translation Files](https://raw.githubusercontent.com/rezatn0934/fastapi-rosetta/main/docs/images/file-list.png)
### Translation Files

![FastAPI Rosetta](https://raw.githubusercontent.com/rezatn0934/fastapi-rosetta/main/docs/images/editor.png)
---

## Why FastAPI Rosetta?

* No Django dependency
* Familiar gettext workflow
* Easy to integrate
* Simple configuration
* Clean web interface
* Optional AI-assisted translation
* Uses standard `.po` and `.mo` files


---

## License

MIT License

---

## Credits

FastAPI Rosetta is inspired by the excellent **Django Rosetta** project and brings a similar translation experience to the FastAPI ecosystem.
