DEV Community

Cover image for Hacktoberfest Participants Help Us Internationalize the user-statistician GitHub Action
Vincent A. Cicirello
Vincent A. Cicirello

Posted on • Edited on

Hacktoberfest Participants Help Us Internationalize the user-statistician GitHub Action

A few months ago, I released a GitHub Action, user-statistician, that generates a detailed GitHub stats SVG entirely within GitHub Actions. It generates a detailed visual summary of your activity on GitHub, such as your contributions, distribution of programming languages within your public repositories, etc, suitable to display on your GitHub Profile README. It can also be customized in various ways. We are now specifically interested in increasing international support by adding translations for other languages. The action currently has built-in support for English, Italian, and German. We would like to expand upon this. Check out the GitHub repository for details:

GitHub logo cicirello / user-statistician

Generate a GitHub stats SVG for your GitHub Profile README in GitHub Actions

user-statistician

user-statistician

Check out all of our GitHub Actions: https://actions.cicirello.org/

About user-statistician Mentioned in Awesome README

GitHub Actions GitHub release (latest by date) Count of Action Users
Build Status build samples CodeQL
Source Info License GitHub top language
Contributors GitHub contributors good first issue
Support GitHub Sponsors Liberapay Ko-Fi

The cicirello/user-statistician GitHub Action generates a detailed visual summary of your activity on GitHub in the form of an SVG suitable to display on your GitHub Profile README Although the intended use-case is to generate an SVG image for your GitHub Profile README, you can also potentially link to the image from a personal website, or from anywhere else where you'd like to share a summary of your activity on GitHub. The SVG that the action generates includes statistics for the repositories that you own, your contribution statistics (e.g., commits, issues, PRs, etc), as well as the distribution of languages within public repositories that you own. The user stats image can be customized, including the colors such as with one of the built-in themes or your own set of custom…

You can also find more information about user-statistician in our prior post on Dev.to:

Table of Contents

  • Hacktoberfest Issues: About the Hacktoberfest labeled issues related to adding support for additional languages.
  • Samples: A few samples in the currently supported languages, and for a couple different color options.
  • How to Try Out the Action: Example workflow to help you try out the action.
  • More Examples: Information on additional examples provided in the GitHub repository.

Hacktoberfest Issues

Initially, it supported only English. However, recently a couple first time contributors translated the various headings and labels into Italian and German. We are interested in further expanding international support by providing additional language options. This is ideal for a first-time contributor as all necessary changes to add support for a new locale are contained in a single source code file, enabling you to easily gain experience in submitting a pull request, having it reviewed, etc. The programming skill level necessary to add support for a new locale is also at the beginning level. Project is implemented in Python and the strings for the various labels are defined within a couple Python dict objects, so adding support for a locale primarily involves adding some entries to a couple Python dictionaries.

To contribute a language translation, all necessary changes involve only editing the file src/StatConfig.py.

There are currently a few open issues for specific languages. But we are open to adding support for any language where there is interest. So if you'd like to contribute a language translation for one not accounted for by one of the open issues, feel free to start by submitting an issue so that we are aware of the language you have interest in contributing, and then follow that with a pull request.

Samples

The user-statistician GitHub Action has a few different built-in themes (light, dark, and dark-dimmed), and also supports custom user-defined colors. Here are a few examples, including of the existing locales.

This first sample is for the default English, and uses the custom color option to match the color palette of my personal website:

Sample with custom colors and default locale en

This next example is for Italian (locale: it), and uses the built-in dark theme:

Sample with dark theme and locale it

This third example is for German (locale: de), and uses the built-in light theme:

Sample with light theme and locale de

Check out my GitHub Profile for an additional live example, which uses the built-in dark theme.

How to Try Out the Action

If you want to try the action out, just drop the following workflow into a file with the name "user-statistician.yml" in the ".github/workflows" directory of your profile repository (or technically any repository that you own). It uses all of the action's default settings, and which runs the action daily on a schedule, and every time the workflow itself is changed (assumes the workflow file name is "user-statistician.yml").

name: user-statistician

on:
  schedule:
    - cron: '0 3 * * *'
  push:
    branches: [ main ]
    paths: [ '.github/workflows/user-statistician.yml' ]
  workflow_dispatch:

jobs:
  stats:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Generate the user stats image
      uses: cicirello/user-statistician@v1
      env:
        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Enter fullscreen mode Exit fullscreen mode

The above uses all of the defaults (light theme, English, etc). See the GitHub repository for details on the available inputs. If you want to change the locale, you can do so as follows (example sets locale for Italian):

name: user-statistician

on:
  schedule:
    - cron: '0 3 * * *'
  push:
    branches: [ main ]
    paths: [ '.github/workflows/user-statistician.yml' ]
  workflow_dispatch:

jobs:
  stats:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Generate the user stats image
      uses: cicirello/user-statistician@v1
      with:
        locale: it
      env:
        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Enter fullscreen mode Exit fullscreen mode

In both cases above, the default filename and location are used for the image (which can be changed with action inputs). Assuming the default filename and location, you can then link to the image in your GitHub README with the following markdown:

![My GitHub Activity](images/userstats.svg)
Enter fullscreen mode Exit fullscreen mode

More Examples

Setting up and configuring the action is easy. The GitHub repository has a quickstart directory containing several ready-to-use workflows to get you started. Pick one, download it, commit it to the .github/workflows directory of your profile's repository, and add a link to the generated image in your README. The quickstart workflows are configured to run nightly on a schedule, on pushes of the workflow file, as well as on workflow_dispatch events (so you can run it manually if need be).

Top comments (0)