Hacktoberfest Language Translation Contributors Wanted for the user-statistician GitHub Action
Tags: hacktoberfest, github, contributorswanted, python
Published: 2022-09-30 13:56:23

## Table of Contents
* [Introduction](#introduction)
* [Hacktoberfest 2022](#hacktoberfest-2022): What you can contribute for this Hacktoberfest.
* [Python (beginner level)](#python-beginner-level): What Python background you need to contribute.
  * [Running Test Cases Locally](#running-test-cases-locally): How to run the Python unit tests locally.
  * [Running With Your Translation Before Submitting PR](#running-with-your-translation-before-submitting-pr): Running the action from your PR branch to visually inspect result.
* [Where You Can Find Me](#where-you-can-find-me)

## Introduction

Earlier this week, I posted an [update regarding new Halloween themes](https://dev.to/cicirello/halloween-themes-for-the-user-statistician-github-action-4do6) for the [user-statistician](https://github.com/cicirello/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](https://github.com/cicirello/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):

![Example](https://raw.githubusercontent.com/cicirello/user-statistician/samples/images/halloween.svg)

## Hacktoberfest 2022 

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](https://github.com/cicirello/user-statistician/issues?q=is%3Aissue+is%3Aopen+label%3A%22Hacktoberfest%22) 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. 

## Python (beginner level) 

The [user-statistician](https://github.com/cicirello/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](https://github.com/cicirello/user-statistician/blob/main/src/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.

### Running Test Cases Locally 

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:

```Shell
python3 -m unittest tests/tests,py
```

Or if on Windows:

```Shell
python -m unittest tests/tests,py
```

### Running With Your Translation Before Submitting PR

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](https://dev.to/cicirello/halloween-themes-for-the-user-statistician-github-action-4do6) or [this one](https://dev.to/cicirello/the-user-statistician-github-action-mentioned-in-awesome-readme-5g3o). 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.


## Where You Can Find Me

On the Web:

{% embed https://www.cicirello.org/ %}

Follow me here on DEV:

{% user cicirello %}

Follow me on GitHub:

{% github cicirello/cicirello %}