Skip to content

feat: Implement API-based Transifex stats generation and CI automation#10

Merged
Revisto merged 5 commits into
3.13from
feature/transifex-stats-visualizer-via-api
May 11, 2025
Merged

feat: Implement API-based Transifex stats generation and CI automation#10
Revisto merged 5 commits into
3.13from
feature/transifex-stats-visualizer-via-api

Conversation

@Revisto
Copy link
Copy Markdown
Owner

@Revisto Revisto commented May 11, 2025

This PR adds new scripts to get translation stats from Transifex using its API. It also sets up a GitHub Action to automatically update these stats in the repository.

What Changed:

  1. Python Scripts for Stats (transifex):

    • Added new functions to fetch data from the Transifex API (like translation progress and contributor activity).
    • Created different "reporters" to make specific files:
      • RESOURCE.md: Shows how much of each file is translated.
      • TEAM.md: Lists contributors and their work.
      • reports/contributor_stats_YYYY_MM_DD.png: A chart showing top contributor activity.
      • README.md: Updated with the latest contributor chart and summary.
    • Added a new command generate-all-stats to main.py.
      • When you run python -m scripts.transifex.main generate-all-stats, it runs all the above reporters one by one.
      • This way, it only needs to get data from the Transifex API once for things that are used in multiple reports, making it faster.
  2. GitHub Actions Workflow (.github/workflows/update-translation-stats.yml):

    • What it does: Automatically runs the generate-all-stats script.
    • When it runs:
      • Every Saturday at midnight (UTC).
      • Can also be run by hand if needed.
    • How it works:
      • Gets the latest code.
      • Sets up Python.
      • Installs the Python packages listed in requirements.txt.
      • Runs the generate-all-stats script (it uses a TRANSIFEX_API_TOKEN secret to talk to Transifex).
      • If the script changes RESOURCE.md, TEAM.md, files in reports, or README.md:
        • It sets up Git.
        • Adds the changed files.
        • Makes a commit with the message "Update translation statistics [skip ci]".
        • Pushes the changes.

Why this is good:

  • Correct Stats: Uses the official Transifex API, so the information is right.
  • Always Up-to-Date: The stats files in the repo will be updated automatically.
  • Runs Faster: The generate-all-stats command is set up to avoid asking Transifex for the same data over and over.
  • Easy to See Progress: Helps everyone see how the Persian Python docs translation is doing and who is helping.

This makes it much easier to track and show our translation work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant