- Hacktoberfest 2022: What you can contribute for this Hacktoberfest.
Python (beginner level): What Python background you need to contribute.
- Running Test Cases Locally: How to run the Python unit tests locally.
- Running With Your Translation Before Submitting PR: Running the action from your PR branch to visually inspect result.
- Where You Can Find Me
Earlier this week, I posted an update regarding new Halloween themes for the user-statistician GitHub Action, which generates an SVG with a detailed summary of your activity on GitHub. Last year at this time, I used Hacktoberfest to recruit contributors to translate all of the headings and labels into other languages. Before Hacktoberfest 2021, the user-statistician GitHub Action supported 3 languages (English, Italian, and German). With the help of Hacktoberfest 2021 contributors, the list of supported languages grew to the following 16 languages: Bahasa Indonesia, Bengali, English, French, German, Hindi, Italian, Japanese, Korean, Lithuanian, Polish, Portuguese, Russian, Spanish, Turkish, Ukrainian. Let's try to double the number of supported languages to further internationalize the action.
Here is an example of what the action produces (using one of the new Halloween themes):
With the success of last year's Hacktoberfest internationalization effort, I added issues corresponding to many more languages. If you are looking for a project to contribute to for Hacktoberfest, and if you are knowledgeable in a language not yet supported, please consider contributing a language translation. At the time I am writing this post, the open issues for language translations include the following languages: Afrikaans, Albanian, Arabic, Armenian, Chinese, Czech, Danish, Dutch, Finnish, Greek, Hungarian, Norwegian, Persian, Romanian, Swedish, Tagalog, Thai, and Vietnamese. If there is an open issue for a language translation that you would like to contribute, start by commenting on the issue. If you are the first to express interest, I'll assign you to the issue.
Can I Contribute a Translation for a Language Not in That List? Of course. In that case, start by submitting an issue so I know you want to work on it. Indicate that you want to contribute the translation so I know the difference between just a request for the translation vs someone who wants to contribute it. I'll then assign you to the issue.
The user-statistician GitHub Action is implemented in Python as a container action. You don't need to know any Docker to contribute, as you won't need to touch the Dockerfile, and the unit tests can run locally with Python alone (the unit tests don't actually query the GitHub API, instead using fake query results). If you know how to add elements to a Python dictionary, then your Python background is sufficient. There is a single Python file that you would need to edit: StatConfig.py. There is a comment within that has an itemized list of what is required to contribute a language translation, and mostly involves adding your translation of the various headings and labels, as well as a translation of the title template, to a couple of Python dictionaries, and adding the language code to a Python set.
After you submit your PR and while I'm reviewing it, I'll approve a GitHub Actions workflow that will run the unit tests, and that workflow will also run the version of the action in your PR branch. You won't need to add unit tests. The existing unit tests will verify that every heading, label, etc has a translation for the newly added language. If you want to run the unit tests locally, then from the command line, at the root of the repository, run the following:
python3 -m unittest tests/tests,py
Or if on Windows:
python -m unittest tests/tests,py
If you want to run the action with your new translation to visually inspect the result before you submit your PR, then follow the instructions in the repository for adding a workflow in your GitHub Profile repository, or you can follow the example of how to do this from one of my prior DEV posts, such as the one from earlier this week or this one. But make the following change to the workflow to point it at your branch in your fork. Where the workflow indicates
uses: cicirello/user-statistician@v1, instead put
uses: YOURUSERID/user-statistician@YOURBRANCHNAME, and also be sure to actually use the
locale input with the code corresponding to the language you are adding, such as
locale: fr for French.
Since those sample workflows includes a
workflow_dispatch event, you can run it manually from the Actions tab of your repository. You can do this from any repository that you own (the action generates the SVG with GitHub activity for the owner of the repository in which it is run, so it doesn't actually need to be your profile repository). Just don't use your fork of the user-statistician to run the action. GitHub by default disables workflows in forks. Additionally, your PR shouldn't include any changes or additions in the workflows directory.
On the Web:
Follow me here on DEV:
Follow me on GitHub:
Vincent A Cicirello
If you want to generate the equivalent to the above for your own GitHub profile, check out the cicirello/user-statistician GitHub Action.