fastapi-rosetta 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastapi_rosetta-0.1.0/.gitignore +217 -0
- fastapi_rosetta-0.1.0/.pre-commit-config.yaml +49 -0
- fastapi_rosetta-0.1.0/.python-version +1 -0
- fastapi_rosetta-0.1.0/LICENSE +22 -0
- fastapi_rosetta-0.1.0/PKG-INFO +243 -0
- fastapi_rosetta-0.1.0/README.md +209 -0
- fastapi_rosetta-0.1.0/docs/images/editor.png +0 -0
- fastapi_rosetta-0.1.0/docs/images/file-list.png +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/__init__.py +20 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/access.py +104 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/conf/__init__.py +130 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/dependencies.py +34 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/jinja.py +256 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ar/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ar/LC_MESSAGES/messages.po +209 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/az/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/az/LC_MESSAGES/messages.po +210 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/cs/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/cs/LC_MESSAGES/messages.po +201 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/de/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/de/LC_MESSAGES/messages.po +206 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/es/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/es/LC_MESSAGES/messages.po +231 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/fa/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/fa/LC_MESSAGES/messages.po +203 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/fr/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/fr/LC_MESSAGES/messages.po +209 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/hu/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/hu/LC_MESSAGES/messages.po +197 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/it/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/it/LC_MESSAGES/messages.po +204 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ky/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ky/LC_MESSAGES/messages.po +197 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/nl/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/nl/LC_MESSAGES/messages.po +203 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/pl/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/pl/LC_MESSAGES/messages.po +213 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ru/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/ru/LC_MESSAGES/messages.po +200 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/tr/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/tr/LC_MESSAGES/messages.po +230 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/uk/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/uk/LC_MESSAGES/messages.po +209 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/xx/LC_MESSAGES/messages.po +33 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/zh_Hans/LC_MESSAGES/messages.mo +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/locale/zh_Hans/LC_MESSAGES/messages.po +212 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/poutil.py +173 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/routers/__init__.py +3 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/routers/rosetta.py +130 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/routers/services.py +817 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/signals.py +32 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/static/rosetta/css/rosetta.css +600 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/static/rosetta/favicon.svg +4 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/static/rosetta/img/icon_searchbox_rosetta.png +0 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/static/rosetta/js/rosetta.js +255 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/storage.py +130 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/templates/rosetta/base.html +131 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/templates/rosetta/file-list.html +151 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/templates/rosetta/form.html +463 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/test_smoke.py +17 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/translate_utils.py +271 -0
- fastapi_rosetta-0.1.0/fastapi_rosetta/version.py +6 -0
- fastapi_rosetta-0.1.0/pyproject.toml +109 -0
- fastapi_rosetta-0.1.0/uv.lock +2036 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
db.sqlite3
|
|
61
|
+
db.sqlite3-journal
|
|
62
|
+
|
|
63
|
+
# Flask stuff:
|
|
64
|
+
instance/
|
|
65
|
+
.webassets-cache
|
|
66
|
+
|
|
67
|
+
# Scrapy stuff:
|
|
68
|
+
.scrapy
|
|
69
|
+
|
|
70
|
+
# Sphinx documentation
|
|
71
|
+
docs/_build/
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
.pybuilder/
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
86
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
87
|
+
# .python-version
|
|
88
|
+
|
|
89
|
+
# pipenv
|
|
90
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
91
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
92
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
93
|
+
# install all needed dependencies.
|
|
94
|
+
# Pipfile.lock
|
|
95
|
+
|
|
96
|
+
# UV
|
|
97
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
98
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
99
|
+
# commonly ignored for libraries.
|
|
100
|
+
# uv.lock
|
|
101
|
+
|
|
102
|
+
# poetry
|
|
103
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
104
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
105
|
+
# commonly ignored for libraries.
|
|
106
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
107
|
+
# poetry.lock
|
|
108
|
+
# poetry.toml
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
113
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
114
|
+
# pdm.lock
|
|
115
|
+
# pdm.toml
|
|
116
|
+
.pdm-python
|
|
117
|
+
.pdm-build/
|
|
118
|
+
|
|
119
|
+
# pixi
|
|
120
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
121
|
+
# pixi.lock
|
|
122
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
123
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
124
|
+
.pixi
|
|
125
|
+
|
|
126
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
127
|
+
__pypackages__/
|
|
128
|
+
|
|
129
|
+
# Celery stuff
|
|
130
|
+
celerybeat-schedule
|
|
131
|
+
celerybeat.pid
|
|
132
|
+
|
|
133
|
+
# Redis
|
|
134
|
+
*.rdb
|
|
135
|
+
*.aof
|
|
136
|
+
*.pid
|
|
137
|
+
|
|
138
|
+
# RabbitMQ
|
|
139
|
+
mnesia/
|
|
140
|
+
rabbitmq/
|
|
141
|
+
rabbitmq-data/
|
|
142
|
+
|
|
143
|
+
# ActiveMQ
|
|
144
|
+
activemq-data/
|
|
145
|
+
|
|
146
|
+
# SageMath parsed files
|
|
147
|
+
*.sage.py
|
|
148
|
+
|
|
149
|
+
# Environments
|
|
150
|
+
.env
|
|
151
|
+
.envrc
|
|
152
|
+
.venv
|
|
153
|
+
env/
|
|
154
|
+
venv/
|
|
155
|
+
ENV/
|
|
156
|
+
env.bak/
|
|
157
|
+
venv.bak/
|
|
158
|
+
|
|
159
|
+
# Spyder project settings
|
|
160
|
+
.spyderproject
|
|
161
|
+
.spyproject
|
|
162
|
+
|
|
163
|
+
# Rope project settings
|
|
164
|
+
.ropeproject
|
|
165
|
+
|
|
166
|
+
# mkdocs documentation
|
|
167
|
+
/site
|
|
168
|
+
|
|
169
|
+
# mypy
|
|
170
|
+
.mypy_cache/
|
|
171
|
+
.dmypy.json
|
|
172
|
+
dmypy.json
|
|
173
|
+
|
|
174
|
+
# Pyre type checker
|
|
175
|
+
.pyre/
|
|
176
|
+
|
|
177
|
+
# pytype static type analyzer
|
|
178
|
+
.pytype/
|
|
179
|
+
|
|
180
|
+
# Cython debug symbols
|
|
181
|
+
cython_debug/
|
|
182
|
+
|
|
183
|
+
# PyCharm
|
|
184
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
185
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
186
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
187
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
188
|
+
.idea/
|
|
189
|
+
|
|
190
|
+
# Abstra
|
|
191
|
+
# Abstra is an AI-powered process automation framework.
|
|
192
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
193
|
+
# Learn more at https://abstra.io/docs
|
|
194
|
+
.abstra/
|
|
195
|
+
|
|
196
|
+
# Visual Studio Code
|
|
197
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
198
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
199
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
200
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
201
|
+
# .vscode/
|
|
202
|
+
# Temporary file for partial code execution
|
|
203
|
+
tempCodeRunnerFile.py
|
|
204
|
+
|
|
205
|
+
# Ruff stuff:
|
|
206
|
+
.ruff_cache/
|
|
207
|
+
|
|
208
|
+
# PyPI configuration file
|
|
209
|
+
.pypirc
|
|
210
|
+
|
|
211
|
+
# Marimo
|
|
212
|
+
marimo/_static/
|
|
213
|
+
marimo/_lsp/
|
|
214
|
+
__marimo__/
|
|
215
|
+
|
|
216
|
+
# Streamlit
|
|
217
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
# ----------------------------------
|
|
3
|
+
# Basic hygiene hooks
|
|
4
|
+
# ----------------------------------
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v6.0.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: check-added-large-files
|
|
11
|
+
args: ["--maxkb=750"]
|
|
12
|
+
- id: check-toml
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
args: ["--unsafe"]
|
|
15
|
+
- id: check-merge-conflict
|
|
16
|
+
|
|
17
|
+
# ----------------------------------
|
|
18
|
+
# Ruff - Linter + isort replacement
|
|
19
|
+
# ----------------------------------
|
|
20
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
|
+
rev: v0.3.5
|
|
22
|
+
hooks:
|
|
23
|
+
- id: ruff
|
|
24
|
+
args:
|
|
25
|
+
- --fix
|
|
26
|
+
- --exit-non-zero-on-fix
|
|
27
|
+
language_version: python3.13
|
|
28
|
+
|
|
29
|
+
# ----------------------------------
|
|
30
|
+
# Black - Code formatter
|
|
31
|
+
# ----------------------------------
|
|
32
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
33
|
+
rev: 24.4.2
|
|
34
|
+
hooks:
|
|
35
|
+
- id: black
|
|
36
|
+
language_version: python3.13
|
|
37
|
+
args: ["--line-length=88"]
|
|
38
|
+
|
|
39
|
+
# ----------------------------------
|
|
40
|
+
# Mypy - Type checking
|
|
41
|
+
# ----------------------------------
|
|
42
|
+
- repo: local
|
|
43
|
+
hooks:
|
|
44
|
+
- id: mypy
|
|
45
|
+
name: mypy
|
|
46
|
+
entry: uv run mypy .
|
|
47
|
+
language: system
|
|
48
|
+
types: [python]
|
|
49
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2008-2023 Marco Bonetti
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastapi-rosetta
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A FastAPI-native translation management interface for gettext translation files.
|
|
5
|
+
Project-URL: Homepage, https://github.com/rezatn0934/fastapi-rosetta.git
|
|
6
|
+
Project-URL: Repository, https://github.com/rezatn0934/fastapi-rosetta.git
|
|
7
|
+
Author-email: Reza Teymouri Nejad <rezatn0934@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: fastapi,gettext,i18n,internationalization,rosetta,translation
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Framework :: FastAPI
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: fastapi>=0.133.1
|
|
24
|
+
Requires-Dist: jinja2>=3.1.6
|
|
25
|
+
Requires-Dist: polib>=1.2.0
|
|
26
|
+
Requires-Dist: pydantic>=2.13.4
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
28
|
+
Requires-Dist: requests>=2.34.2
|
|
29
|
+
Provides-Extra: google
|
|
30
|
+
Requires-Dist: google-cloud-translate>=3.27.0; extra == 'google'
|
|
31
|
+
Provides-Extra: openai
|
|
32
|
+
Requires-Dist: openai>=2.53.0; extra == 'openai'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# FastAPI Rosetta
|
|
36
|
+
|
|
37
|
+
A modern translation management interface for **FastAPI** applications using GNU gettext (`.po`) files.
|
|
38
|
+
|
|
39
|
+
FastAPI Rosetta lets translators and developers edit, search, and manage translation files directly from a clean web interface—without relying on Django.
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
* 🌍 Browse all translation files from one place
|
|
48
|
+
* ✏️ Edit translations directly in your browser
|
|
49
|
+
* 🔍 Search messages instantly
|
|
50
|
+
* 🏷️ Filter translated, untranslated, or fuzzy entries
|
|
51
|
+
* 🌐 Support multiple languages
|
|
52
|
+
* 🔄 Reference another language while translating
|
|
53
|
+
* 🤖 Machine translation support (Google Cloud & OpenAI)
|
|
54
|
+
* 📦 Download translations as ZIP files
|
|
55
|
+
* ⚡ Automatically compile `.mo` files after saving
|
|
56
|
+
* 🎨 Lightweight, FastAPI-native interface
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
Install the package:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
uv add fastapi-rosetta
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or using pip:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install fastapi-rosetta
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Optional translation providers
|
|
75
|
+
|
|
76
|
+
Google Cloud
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv add "fastapi-rosetta[google]"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
OpenAI
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
uv add "fastapi-rosetta[openai]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Both
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv add "fastapi-rosetta[google,openai]"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Quick Start
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from pathlib import Path
|
|
100
|
+
|
|
101
|
+
from fastapi import FastAPI
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
from fastapi_rosetta import RosettaConfig, configure, mount_static
|
|
105
|
+
from fastapi_rosetta import router as rosetta_router
|
|
106
|
+
|
|
107
|
+
app = FastAPI()
|
|
108
|
+
|
|
109
|
+
BASE_DIR = Path(__file__).resolve().parent
|
|
110
|
+
|
|
111
|
+
configure(
|
|
112
|
+
RosettaConfig(
|
|
113
|
+
requires_auth=True,
|
|
114
|
+
locale_paths=(
|
|
115
|
+
str(BASE_DIR / "locales"),
|
|
116
|
+
),
|
|
117
|
+
languages=(
|
|
118
|
+
("fa", "Persian"),
|
|
119
|
+
("en", "English"),
|
|
120
|
+
),
|
|
121
|
+
messages_per_page=20,
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
app.include_router(rosetta_router)
|
|
126
|
+
|
|
127
|
+
mount_static(app)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Start your application:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
uvicorn main:app --reload
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Then open:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
http://localhost:8000/rosetta/
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Translation Files
|
|
145
|
+
|
|
146
|
+
FastAPI Rosetta works with standard GNU gettext files.
|
|
147
|
+
|
|
148
|
+
Example directory structure:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
locale/
|
|
152
|
+
├── en/
|
|
153
|
+
│ └── LC_MESSAGES/
|
|
154
|
+
│ ├── messages.po
|
|
155
|
+
│ └── messages.mo
|
|
156
|
+
│
|
|
157
|
+
├── fa/
|
|
158
|
+
│ └── LC_MESSAGES/
|
|
159
|
+
│ ├── messages.po
|
|
160
|
+
│ └── messages.mo
|
|
161
|
+
│
|
|
162
|
+
└── de/
|
|
163
|
+
└── LC_MESSAGES/
|
|
164
|
+
├── messages.po
|
|
165
|
+
└── messages.mo
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Typical Workflow
|
|
171
|
+
|
|
172
|
+
1. Open the Rosetta interface.
|
|
173
|
+
2. Select a language.
|
|
174
|
+
3. Choose a translation file.
|
|
175
|
+
4. Search or browse messages.
|
|
176
|
+
5. Edit translations.
|
|
177
|
+
6. Save your changes.
|
|
178
|
+
7. Download the updated translation files if needed.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Use Cases
|
|
183
|
+
|
|
184
|
+
FastAPI Rosetta is suitable for:
|
|
185
|
+
|
|
186
|
+
* SaaS applications
|
|
187
|
+
* Admin dashboards
|
|
188
|
+
* Business applications
|
|
189
|
+
* Multi-language websites
|
|
190
|
+
* APIs with translated content
|
|
191
|
+
* Open-source projects
|
|
192
|
+
* Internal company tools
|
|
193
|
+
* FastAPI microservices
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Machine Translation
|
|
198
|
+
|
|
199
|
+
FastAPI Rosetta can suggest translations using supported providers.
|
|
200
|
+
|
|
201
|
+
Currently supported:
|
|
202
|
+
|
|
203
|
+
* Google Cloud Translation
|
|
204
|
+
* OpenAI
|
|
205
|
+
|
|
206
|
+
These providers are optional and can be installed only when needed.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Screenshots
|
|
211
|
+
|
|
212
|
+
### Translation Editor
|
|
213
|
+
|
|
214
|
+

|
|
215
|
+
|
|
216
|
+
### Translation Files
|
|
217
|
+
|
|
218
|
+

|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Why FastAPI Rosetta?
|
|
223
|
+
|
|
224
|
+
* No Django dependency
|
|
225
|
+
* Familiar gettext workflow
|
|
226
|
+
* Easy to integrate
|
|
227
|
+
* Simple configuration
|
|
228
|
+
* Clean web interface
|
|
229
|
+
* Optional AI-assisted translation
|
|
230
|
+
* Uses standard `.po` and `.mo` files
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT License
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Credits
|
|
242
|
+
|
|
243
|
+
FastAPI Rosetta is inspired by the excellent **Django Rosetta** project and brings a similar translation experience to the FastAPI ecosystem.
|