Skip to content

Commit 4167f66

Browse files
Add string completion to README (#94)
Co-authored-by: Maciej Olko <maciej.olko@gmail.com>
1 parent ffa56e7 commit 4167f66

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

README.en.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ Polish Translation of Python Documentation
44
from manage_translation import get_resource_language_stats, progress_from_resources, language_switcher, get_number_of_translators
55
66
stats = get_resource_language_stats()
7-
total = progress_from_resources(stats)
7+
total_words, total_strings = progress_from_resources(stats)
88
translators = get_number_of_translators()
99
1010
print(
1111
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)
12-
![Total Translation of Documentation](https://img.shields.io/badge/Total-{total:.3f}%25-0.svg)
12+
[![Total Translation of Documentation](https://img.shields.io/badge/total_words-{total_words:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
13+
[![Total Translation of Documentation](https://img.shields.io/badge/total_strings-{total_strings:.2f}%25-0.svg)](https://python-docs-translations.github.io/dashboard/)
1314
![{translators} Translators](https://img.shields.io/badge/Translators-{translators}-0.svg)''')
1415
]]] -->
1516
[![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)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ Polskie tłumaczenie dokumentacji Pythona
44
from manage_translation import get_resource_language_stats, progress_from_resources, get_number_of_translators
55
66
stats = get_resource_language_stats()
7-
total = progress_from_resources(stats)
7+
total_words, total_strings = progress_from_resources(stats)
88
translators = get_number_of_translators()
99
1010
print(
1111
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)
12-
![postęp tłumaczenia całości dokumentacji](https://img.shields.io/badge/całość-{total:.3f}%25-0.svg)
12+
[![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/)
13+
[![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/)
1314
![{translators} tłumaczy](https://img.shields.io/badge/tłumaczy-{translators}-0.svg)''')
1415
]]] -->
1516
[![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)

manage_translation.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from transifex.api import transifex_api
3030

3131
LANGUAGE = 'pl'
32+
PROJECT_SLUG = 'python-newest'
33+
VERSION = '3.14'
3234

3335

3436
def fetch():
@@ -49,10 +51,6 @@ def _call(command: str):
4951
exit(return_code)
5052

5153

52-
PROJECT_SLUG = 'python-newest'
53-
VERSION = '3.14'
54-
55-
5654
def recreate_tx_config():
5755
"""
5856
Regenerate Transifex client config for all resources.
@@ -151,10 +149,12 @@ def get_resource_language_stats() -> list[ResourceLanguageStatistics]:
151149
return [ResourceLanguageStatistics.from_api_entry(entry) for entry in resources]
152150

153151

154-
def progress_from_resources(resources: Iterable[ResourceLanguageStatistics]) -> float:
155-
pairs = ((e.translated_words, e.total_words) for e in resources)
156-
translated_total, total_total = (sum(counts) for counts in zip(*pairs))
157-
return translated_total / total_total * 100
152+
def progress_from_resources(resources: Iterable[ResourceLanguageStatistics]) -> tuple[float, float]:
153+
word_pairs = ((e.translated_words, e.total_words) for e in resources)
154+
string_pairs = ((e.translated_strings, e.total_strings) for e in resources)
155+
translated_total_words, total_words = (sum(counts) for counts in zip(*word_pairs))
156+
translated_total_strs, total_strs = (sum(counts) for counts in zip(*string_pairs))
157+
return translated_total_words / total_words * 100, translated_total_strs / total_strs * 100
158158

159159

160160
def get_number_of_translators():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy