From 926d3ea3dc56d15f74789223812d93d5a0114f7c Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Thu, 19 Jun 2025 11:22:16 +0100 Subject: [PATCH 1/3] More links! --- README.en.md | 2 +- README.md | 2 +- manage_translation.py | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.en.md b/README.en.md index 709faac6b..f720a4120 100644 --- a/README.en.md +++ b/README.en.md @@ -9,7 +9,7 @@ translators = get_number_of_translators() print( f'''[![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) -![Total Translation of Documentation](https://img.shields.io/badge/Total-{total:.3f}%25-0.svg) +[![Total Translation of Documentation](https://img.shields.io/badge/Total-{total:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) ![{translators} Translators](https://img.shields.io/badge/Translators-{translators}-0.svg)''') ]]] --> [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) diff --git a/README.md b/README.md index 0d8c09991..240bcca6e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ translators = get_number_of_translators() print( f'''[![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) -![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość-{total:.3f}%25-0.svg) +[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość-{total:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) ![{translators} tłumaczy](https://img.shields.io/badge/tłumaczy-{translators}-0.svg)''') ]]] --> [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) diff --git a/manage_translation.py b/manage_translation.py index 7d53b2f23..8915c6b4f 100755 --- a/manage_translation.py +++ b/manage_translation.py @@ -29,6 +29,8 @@ from transifex.api import transifex_api LANGUAGE = 'pl' +PROJECT_SLUG = 'python-newest' +VERSION = '3.14' def fetch(): @@ -49,10 +51,6 @@ def _call(command: str): exit(return_code) -PROJECT_SLUG = 'python-newest' -VERSION = '3.14' - - def recreate_tx_config(): """ Regenerate Transifex client config for all resources. @@ -152,7 +150,7 @@ def get_resource_language_stats() -> list[ResourceLanguageStatistics]: def progress_from_resources(resources: Iterable[ResourceLanguageStatistics]) -> float: - pairs = ((e.translated_words, e.total_words) for e in resources) + pairs = ((e.translated_strings, e.total_strings) for e in resources) translated_total, total_total = (sum(counts) for counts in zip(*pairs)) return translated_total / total_total * 100 From a36c88991ad0f1a00b398231236c54d1b92615af Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Fri, 20 Jun 2025 11:48:16 +0100 Subject: [PATCH 2/3] Review --- README.en.md | 5 +++-- README.md | 5 +++-- manage_translation.py | 10 ++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.en.md b/README.en.md index f720a4120..80be79893 100644 --- a/README.en.md +++ b/README.en.md @@ -4,12 +4,13 @@ Polish Translation of Python Documentation from manage_translation import get_resource_language_stats, progress_from_resources, language_switcher, get_number_of_translators stats = get_resource_language_stats() -total = progress_from_resources(stats) +total_words, total_strings = progress_from_resources(stats) translators = get_number_of_translators() print( f'''[![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) -[![Total Translation of Documentation](https://img.shields.io/badge/Total-{total:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) +[![Total Translation of Documentation](https://img.shields.io/badge/total_words-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) +[![Total Translation of Documentation](https://img.shields.io/badge/total_strings-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) ![{translators} Translators](https://img.shields.io/badge/Translators-{translators}-0.svg)''') ]]] --> [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) diff --git a/README.md b/README.md index 240bcca6e..6a1283de7 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ Polskie tłumaczenie dokumentacji Pythona from manage_translation import get_resource_language_stats, progress_from_resources, get_number_of_translators stats = get_resource_language_stats() -total = progress_from_resources(stats) +total_words, total_strings = progress_from_resources(stats) translators = get_number_of_translators() print( f'''[![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) -[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość-{total:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) +[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_słow-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) +[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_napisów-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) ![{translators} tłumaczy](https://img.shields.io/badge/tłumaczy-{translators}-0.svg)''') ]]] --> [![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) diff --git a/manage_translation.py b/manage_translation.py index 8915c6b4f..e8a042a6a 100755 --- a/manage_translation.py +++ b/manage_translation.py @@ -149,10 +149,12 @@ def get_resource_language_stats() -> list[ResourceLanguageStatistics]: return [ResourceLanguageStatistics.from_api_entry(entry) for entry in resources] -def progress_from_resources(resources: Iterable[ResourceLanguageStatistics]) -> float: - pairs = ((e.translated_strings, e.total_strings) for e in resources) - translated_total, total_total = (sum(counts) for counts in zip(*pairs)) - return translated_total / total_total * 100 +def progress_from_resources(resources: Iterable[ResourceLanguageStatistics]) -> tuple[float, float]: + word_pairs = ((e.translated_words, e.total_words) for e in resources) + string_pairs = ((e.translated_strings, e.total_strings) for e in resources) + translated_total_words, total_words = (sum(counts) for counts in zip(*word_pairs)) + translated_total_strs, total_strs = (sum(counts) for counts in zip(*string_pairs)) + return translated_total_words / total_words * 100, translated_total_strs / total_strs * 100 def get_number_of_translators(): From babd4c12e65edd59eeec16d7a3233340a92e1642 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:03:51 +0100 Subject: [PATCH 3/3] Update README.md Co-authored-by: Maciej Olko --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a1283de7..4653311d8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ translators = get_number_of_translators() print( f'''[![build](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml/badge.svg)](https://github.com/python/python-docs-pl/actions/workflows/update-lint-and-build.yml) -[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_słow-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) +[![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_słów-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) [![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość_napisów-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/) ![{translators} tłumaczy](https://img.shields.io/badge/tłumaczy-{translators}-0.svg)''') ]]] -->