Contributing
January 14, 2026 · View on GitHub
Instructions:
- Fork the repository and clone it on your computer
- Install dependencies
- Update source code and add tests for any code you create
- Run the tests to verify your updates didn't break anything
- Once your code is ready, documented and tested, please make a pull request
Testing
tox
To run the tests, install the project dependencies in a virtual environment and then run tox:
python -m venv i18n_env
source i18n_env/bin/activate
pip install -r requirements.txt
tox
The command to activate the virtual environment on Windows is:
i18n_env\Scripts\activate.bat
Python “Virtual Environments” allow Python packages to be installed in an isolated location
for a particular application, rather than being installed globally.
You should run all your Python commands with your virtual environment activated.
Once you are done using Python, you can exit the virtual environment by entering deactivate in your terminal.
Anytime we need to add more packages, we install them like so and then update our requirements file:
pip install "<package_name>"
pip freeze > requirements.txt
vcrpy
In addition to pytest, we also use the vcrpy library when writing our tests.
If you need to update or regenerate a cassette for a test, i.e. tests/cassettes/test_translate_missing_messages_without_sorting.yml, then:
- delete the cassette yml file
- update the
os.environ["TRANSLATOR_API_SUBSCRIPTION_KEY"]line in the test so it is set to a real API key (but do not commit this change) - run the tests with
tox. This will regenerate the cassette yml file - revert the
os.environ["TRANSLATOR_API_SUBSCRIPTION_KEY"]line in the test so it is no longer a real API key
Editable installation
Alternatively, you can perform an editable installation of this package inside of a virtual environment:
python -m venv i18n_env
source i18n_env/bin/activate
pip install -r requirements.txt
pip install --editable .
pytest
Performing an editable installation of this package inside of a virtual environment allows you to call the CLI scripts and test out actually calling the Azure API and translating files:
export TRANSLATOR_API_SUBSCRIPTION_KEY=<your_key>
translate -i=messages.properties -t=es
translate-missing -i=messages.properties -t=no
It also allows you to test out your changes by calling the updated methods in a Python file.
For example, you could make a file changes.py:
import i18ntools.translate_missing
input_file = "i18n/messageBundle.properties"
output_lang = "es"
sort_file = True
i18ntools.translate_missing.translate_missing_messages(input_file, output_lang, sort_file)
And then execute it to confirm translate_missing_messages runs as expected:
export TRANSLATOR_API_SUBSCRIPTION_KEY=<your_key>
python changes.py