Translation Finder
raw JSON → 2.24 verified Fri May 01 auth: no python
A Python library to locate translation files in a project, used by Weblate. Version 2.24 requires Python >=3.11. Released irregularly as needed by Weblate.
pip install translation-finder Common errors
error ModuleNotFoundError: No module named 'translation_finder' ↓
cause Misspelling: the package is 'translation-finder' with hyphen, but import uses underscore.
fix
Ensure you installed
pip install translation-finder and import as import translation_finder. error AttributeError: 'generator' object has no attribute 'filename' ↓
cause Trying to access attributes on the generator directly instead of iterating over Findings.
fix
Iterate over the generator:
for f in get_translations(path): then access f.filename. Warnings
deprecated The function `get_translations` may be deprecated in future versions in favor of a class-based API. Check latest docs before upgrading. ↓
fix Use `from translation_finder.finder import TranslationFinder` and instantiate with the path.
gotcha `get_translations` returns a generator, not a list. If you need to reuse the results, convert to a list explicitly. ↓
fix `results = list(get_translations('/path'))`
Imports
- Finding
from translation_finder.finder import Finding - get_translations
from translation_finder.finder import get_translations
Quickstart
from translation_finder.finder import get_translations
# Scan a directory for translation files
results = get_translations('/path/to/project')
for f in results:
print(f.filename, f.language, f.format, f.documentation)