feat: make UI strings localisable via LOCALE environment variable
Agent-Logs-Url: https://github.com/wasi-master/13ft/sessions/3b6e6061-c4d2-4aa1-879b-8526ccd3b1db Co-authored-by: wasi-master <63045920+wasi-master@users.noreply.github.com>
This commit is contained in:
co-authored by
wasi-master
parent
ef12cd0184
commit
ce8e8c1664
@@ -160,7 +160,47 @@ WantedBy=multi-user.target
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
## Localisation
|
||||
|
||||
The UI strings can be localised by setting the `LOCALE` environment variable to a supported locale code before starting the server. Locale files live in `app/locales/<locale>.json`.
|
||||
|
||||
**Built-in locales**
|
||||
|
||||
| Code | Language |
|
||||
|------|----------|
|
||||
| `en` | English (default) |
|
||||
| `de` | German |
|
||||
| `fr` | French |
|
||||
|
||||
**Running with a different locale**
|
||||
|
||||
```sh
|
||||
# Standard Python
|
||||
LOCALE=de python portable.py
|
||||
|
||||
# Flask dev server
|
||||
LOCALE=fr FLASK_APP=app/portable.py flask run
|
||||
|
||||
# Docker Compose – add to docker-compose.yaml
|
||||
environment:
|
||||
- LOCALE=de
|
||||
```
|
||||
|
||||
**Adding a new locale**
|
||||
|
||||
Create `app/locales/<code>.json` with the following keys (any keys you omit fall back to English):
|
||||
|
||||
```json
|
||||
{
|
||||
"heading": "Enter Website Link",
|
||||
"label": "Link of the website you want to remove paywall for:",
|
||||
"submit": "Submit",
|
||||
"toggle_dark_mode": "Toggle Dark Mode",
|
||||
"invalid_url": "Invalid URL"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user