Hacktoberfest 2023 Contributors Wanted: Additional Translations for the user-statistician GitHub Action
Tags: hack23maintainer, hacktoberfest23, github, i18n
Published: 2023-09-30 19:07:50

## Table of Contents

* [Introduction](#introduction)
* [Current International Support](#current-international-support)
* [Hacktoberfest 2023](#hacktoberfest-2023)
* [More Information](#more-information)
* [Where You Can Find Me](#where-you-can-find-me) 

## Introduction

The [user-statistician](https://github.com/cicirello/user-statistician) GitHub Action can generate an SVG with a detailed summary of your activity on GitHub. It is mentioned in the tools section of the [awesome README awesome list](https://github.com/matiassingers/awesome-readme). The SVG it generates includes general information about you (e.g., year you joined, number of followers, number you are following, most starred repository, etc), information about your repositories (e.g., numbers of stars and forks, etc), information about your contributions (e.g., numbers of commits, issues, PRs, etc), and the distribution of languages within your public repositories.

It is customizable in a variety of ways, such as color themes, custom colors, custom ordering of the sections and statistics within a section, including or excluding entire sections or individual statistics, etc. One of the ways that you can customize it is for locale. For this Hacktoberfest, I am hoping to further increase internationalization, and I'm looking for contributors who would like to translate the various section headings, labels, etc to additional languages.

Here is an example of what it generates (using one of the built-in Halloween themes): 

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


## Current International Support

Last year, during Hacktoberfest 2022, contributors helped increase international support with the addition of 8 language translations bringing the total supported languages to the following 24: 

| locale code | language |
| :--- | :--- |
| id | Bahasa Indonesia |
| bn | Bengali |
| nl | Dutch |
| en | English |
| fr | French |
| de | German |
| hi | Hindi |
| hu | Hungarian |
| it | Italian |
| ja | Japanese |
| ko | Korean |
| lt | Lithuanian |
| no | Norwegian |
| or | Odia |
| pl | Polish |
| pt | Portuguese |
| ro | Romanian | 
| ru | Russian |
| sat | Santali |
| sr | Serbian |
| es | Spanish |
| th | Thai |
| tr | Turkish |
| uk | Ukrainian |


## Hacktoberfest 2023

There are currently [13 open issues for language translations](https://github.com/cicirello/user-statistician/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). Additionally, if you'd like to contribute a translation to a language not already supported that doesn't already have an associated issue, you can start by submitting an issue.

The user-statistician GitHub Action is mostly implemented in Python. However, you can likely contribute even if you know very little Python (or even none for that matter). Each locale is defined within a JSON file. If you are a past contributor, you might remember all of the locales being defined in a single Python source file within a few Python dictionary objects. This was actually very tedious for me to merge Hacktoberfest PRs, since there were frequent conflicts (e.g., 2 or more contributors adding 2 or more different translations in the same position within a Python dictionary). To make things easier, a few weeks ago, I refactored to pull all of the translations out into JSON files, one per locale.

Here is an example of `en.json` for locale code `en` for the English language version:

```JSON
{
  "titleTemplate": "{0}'s GitHub Activity",
  "categoryLabels": {
    "general": {
      "heading": "General Stats and Info",
      "column-one": null,
      "column-two": null
    },
    "repositories": {
      "heading": "Repositories",
      "column-one": "Non-Forks",
      "column-two": "All"
    },
    "contributions": {
      "heading": "Contributions",
      "column-one": "Past Year",
      "column-two": "Total"
    },
    "languages": {
      "heading": "Language Distribution in Public Repositories",
      "column-one": null,
      "column-two": null
    }
  },
  "statLabels": {
    "joined": "Year Joined",
    "featured": "Featured Repo",
    "mostStarred": "Most Starred Repo",
    "mostForked": "Most Forked Repo",
    "followers": "Followers",
    "following": "Following",
    "sponsors": "Sponsors",
    "sponsoring": "Sponsoring",
    "public": "My Repositories",
    "starredBy": "Starred By",
    "forkedBy": "Forked By",
    "watchedBy": "Watched By",
    "templates": "Templates",
    "archived": "Archived",
    "commits": "Commits",
    "issues": "Issues",
    "prs": "Pull Requests",
    "reviews": "Pull Request Reviews",
    "contribTo": "Contributed To",
    "private": "Private Contributions"
  }
}
```

Contributing a language translation mostly involves creating a new JSON file named with the [ISO 639-1 two-character code](https://www.loc.gov/standards/iso639-2/php/English_list.php) for the language, or for languages that don't have a two-character code, the [ISO 639-2 three-character language code](https://www.loc.gov/standards/iso639-2/php/English_list.php). Then within that JSON file, translating all of the string values. You also need to add the locale code to a Python set of supported locales within [src/StatConfig.py](https://github.com/cicirello/user-statistician/blob/main/src/StatConfig.py).

There are detailed instructions for [contributing a language translation](https://github.com/cicirello/user-statistician#contributing-a-translation) within the README in the repository.


## More Information

For more information about the user-statistician GitHub Action, see the other DEV posts in this series, as well as its GitHub repository and a webpage about the action, and please consider giving the repository a star:

{% github cicirello/user-statistician %}

{% embed https://actions.cicirello.org/user-statistician/ %}


## Where You Can Find Me

Follow me [here on DEV](https://dev.to/cicirello) and on [GitHub](https://github.com/cicirello):

{% user cicirello %}

Or visit my website:

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