This repository contains community-maintained language translations for TG-FileStream.
It allows contributors to add new language support without modifying the core project.
TG-FileStream uses a registry-based translation system.
All reply messages are defined as class variables inside language classes.
This repository provides:
- Official translations
- Community language support
- Standardized language structure
- Easy contribution workflow
You can install this plugin using either of the following methods.
Clone this repository inside the patches directory of TG-FileStream.
Your folder structure should look like this:
<TG-FileStream base folder>/
│
├── .git
├── tgfs/
│ ├── patches/
│ │ └── tgfs-translation ← clone this repo here
Example:
cd <TG-FileStream base folder>/tgfs/patches
git clone https://github.com/SpringsFern/tgfs-translationYou can install this plugin directly via pip using the Git repository:
pip3 install git+https://github.com/SpringsFern/tgfs-translation
This method uses TGFS entry-point plugin loading and does not require placing files inside the patches directory.
In the core project:
- A base language class (
en) is defined. - A registry dictionary maps language codes to classes.
- Messages are dynamically fetched from the active language class.
Example:
registry["en"] = enTo add a new language, you:
- Create a class that inherits from
en - Override required text variables
- Register it with a language code
Example:
tgfs_translation/
│
├── en.py
├── es.py
├── hi.py
└── README.md
Each file defines one language.
Example: es.py
from tgfs.utils.translation import registry, en
class Spanish(en):
START_TEXT = "Hola! Envíame cualquier archivo y generaré un enlace."
ERROR_TEXT = "Algo salió mal. Inténtalo de nuevo."
registry["es"] = Spanish- Use ISO 639-1 language codes when possible.
- Examples:
en→ Englishes→ Spanishhi→ Hindifr→ Frenchkn→ Kannada
- Fork this repository.
- Create a new language file (e.g.,
de.py). - Inherit from
en. - Override required variables.
- Submit a Pull Request.
Check the base translation file in:
https://github.com/SpringsFern/TG-FileStream/blob/main/tgfs/utils/translation.py
You must override at least:
- START_TEXT
- ERROR_TEXT
- Any user-visible message
If a variable is not overridden, it will fallback to English.
- Keep tone consistent.
- Do not remove formatting placeholders.
- Preserve dynamic variables.
- Test all overridden messages.
Example of preserving formatting:
FILE_ID_NOT_FOUND = "File with id `{file_id}` not found."Do not remove {file_id}.
This allows:
- Independent updates
- Community contributions
- Cleaner core project
- Easier language maintenance
This repository follows the same license as TG-FileStream.
Thanks to all contributors helping make TG-FileStream accessible in multiple languages.