This a sample for language localization of a telegram bot in three different language English,Amharic and Afan-Oromo.
# LLSample-Telegram-Bots
A minimal sample repository demonstrating Telegram bot localization (i18n) and deployment helpers. This project contains translation files, a small `i18n.py` helper, and a script to compile translations into binary catalogs.
**Key files**
- `i18n.py` — localization helper and loader
- `scripts/compile_translations.py` — compiles `.po` files into `.mo`
- `locales/` — language directories with `LC_MESSAGES/messages.po`
- `requirements.txt` — Python dependencies
- `Dockerfile` and `docker-compose.yml` — containerized runtime
## Features
- Simple i18n-ready structure using gettext `.po` files
- Helper script to compile translations
- Docker support for consistent runtime
## Requirements
- Python 3.8+
- pip
- (Optional) Docker & docker-compose
## Setup (local)
1. Create and activate a virtual environment:
```powershell
python -m venv venv
venv\Scripts\Activate.ps1
```
2. Install dependencies:
```powershell
pip install -r requirements.txt
```
3. Compile translations (if you edit `.po` files):
```powershell
python scripts/compile_translations.py
```
4. Run your bot or script that uses `i18n.py`.
## Running with Docker
Build and run using the included Docker files:
```powershell
docker compose build
docker compose up
```
Adjust the `docker-compose.yml` environment variables for tokens or configuration as needed.
## Localization workflow
- Edit translations in `locales/ /LC_MESSAGES/messages.po`.
- Compile them into binary `.mo` files using `scripts/compile_translations.py`.
- `i18n.py` is provided to load and use the compiled translations at runtime.
## Contributing
- Open issues or pull requests for improvements.
- Keep translations in sync with source strings and run the compile script when updating `.po` files.
## Where to look
- See the `i18n.py` helper in the repository root for usage.
- See `scripts/compile_translations.py` for the compile step.
## License
MI …