This project provides language translations for the Robot Framework Browser library.
Currently supported languages:
- Finnish (
fi) viatranslation_fi.json - German (
de) viatranslation_de.json
The package is discovered by Browser through Python plugin naming conventions
(robotframework_browser_translation) and exposes get_language() with available
translation files.
This project uses Browser library
Python plugin API
to provide
translation files for the Browser library. The get_language() method returns a
list of dictionaries like this:
[
{"language": "fi", "path": "/path/to/translation_fi.json"},
{"language": "de", "path": "/path/to/translation_de.json"},
]Browser uses these values to select the requested language when Browser is imported.
Install the translation package (and Browser, if not installed yet):
pip install robotframework-browser robotframework-browser-translationThen choose the language in the Browser import:
*** Settings ***
Library Browser language=fior:
*** Settings ***
Library Browser language=deThis repository includes uv in development requirements. A common local setup is:
uv venv
source .venv/bin/activate
uv pip install -e .
uv pip install -r requirements-dev.txtRun checks/tests:
uv run invoke utest
uv run invoke lint- Create a new translation file from Browser's current keywords:
uv run python -m Browser.entry translation robotframework_browser_translation/translation_xx.json- Translate values in
nameanddocfields intranslation_xx.json. - Keep
sha256values as generated (they are used to detect upstream doc changes). - Register the new language in
robotframework_browser_translation/__init__.pyinsideget_language(). - Verify checksums and test suite:
uv run invoke utestOptional checksum comparison against current Browser docs:
uv run rfbrowser translation --compare robotframework_browser_translation/translation_xx.jsonThis project keeps Python unit tests in utest/test_translation.py.
Useful commands:
uv run invoke utest
uv run pytest -q
uv run pytest -k checksum -qHow pytest works here:
- Test discovery: pytest collects functions whose names start with
test_. - Fixtures: reusable setup blocks (
language,translation_file,data) provide test inputs. - Parametrization: the
languagefixture runs dependent tests once per language (fi,de). - Assertion style: plain
assert ...statements are enough; pytest prints useful failure diffs.
Tip:
If you add a new language, add its code to SUPPORTED_LANGUAGES in utest/test_translation.py so the same checks run automatically.
Each translation_xx.json contains a sha256 value for every keyword. The
checksum is generated from the original Browser library documentation and is
used to detect outdated or missing translations.
Use:
rfbrowser translation --compare robotframework_browser_translation/translation_xx.json
The command prints keywords that are missing from the translation file or need to be updated.
Tatu Aalto 💻 📖 |
Florian Wellens 💻 📖 |