File tree Expand file tree Collapse file tree 2 files changed +121
-121
lines changed Expand file tree Collapse file tree 2 files changed +121
-121
lines changed Original file line number Diff line number Diff line change 11{
2- "es" : {
3- "continuous-integration" : {
4- "total" : 38 ,
5- "translated" : 0 ,
6- "fuzzy" : 0 ,
7- "untranslated" : 38 ,
8- "percentage" : 0.0
9- },
10- "CONTRIBUTING" : {
11- "total" : 124 ,
12- "translated" : 0 ,
13- "fuzzy" : 0 ,
14- "untranslated" : 124 ,
15- "percentage" : 0.0
16- },
17- "documentation" : {
18- "total" : 9 ,
19- "translated" : 8 ,
20- "fuzzy" : 1 ,
21- "untranslated" : 0 ,
22- "percentage" : 88.89
23- },
24- "index" : {
25- "total" : 14 ,
26- "translated" : 11 ,
27- "fuzzy" : 1 ,
28- "untranslated" : 2 ,
29- "percentage" : 78.57
30- },
31- "package-structure-code" : {
32- "total" : 131 ,
33- "translated" : 126 ,
34- "fuzzy" : 1 ,
35- "untranslated" : 4 ,
36- "percentage" : 96.18
37- },
38- "tests" : {
39- "total" : 1 ,
40- "translated" : 0 ,
41- "fuzzy" : 1 ,
42- "untranslated" : 0 ,
43- "percentage" : 0.0
44- },
45- "TRANSLATING" : {
46- "total" : 108 ,
47- "translated" : 0 ,
48- "fuzzy" : 0 ,
49- "untranslated" : 108 ,
50- "percentage" : 0.0
51- },
52- "tutorials" : {
53- "total" : 12 ,
54- "translated" : 11 ,
55- "fuzzy" : 1 ,
56- "untranslated" : 0 ,
57- "percentage" : 91.67
58- }
2+ "es" : {
3+ "continuous-integration" : {
4+ "total" : 38 ,
5+ "translated" : 0 ,
6+ "fuzzy" : 0 ,
7+ "untranslated" : 38 ,
8+ "percentage" : 0.0
599 },
60- "ja" : {
61- "continuous-integration" : {
62- "total" : 38 ,
63- "translated" : 38 ,
64- "fuzzy" : 0 ,
65- "untranslated" : 0 ,
66- "percentage" : 100.0
67- },
68- "CONTRIBUTING" : {
69- "total" : 124 ,
70- "translated" : 124 ,
71- "fuzzy" : 0 ,
72- "untranslated" : 0 ,
73- "percentage" : 100.0
74- },
75- "documentation" : {
76- "total" : 468 ,
77- "translated" : 467 ,
78- "fuzzy" : 1 ,
79- "untranslated" : 0 ,
80- "percentage" : 99.79
81- },
82- "index" : {
83- "total" : 14 ,
84- "translated" : 11 ,
85- "fuzzy" : 1 ,
86- "untranslated" : 2 ,
87- "percentage" : 78.57
88- },
89- "package-structure-code" : {
90- "total" : 87 ,
91- "translated" : 86 ,
92- "fuzzy" : 1 ,
93- "untranslated" : 0 ,
94- "percentage" : 98.85
95- },
96- "tests" : {
97- "total" : 1 ,
98- "translated" : 0 ,
99- "fuzzy" : 1 ,
100- "untranslated" : 0 ,
101- "percentage" : 0.0
102- },
103- "TRANSLATING" : {
104- "total" : 25 ,
105- "translated" : 24 ,
106- "fuzzy" : 1 ,
107- "untranslated" : 0 ,
108- "percentage" : 96.0
109- },
110- "tutorials" : {
111- "total" : 12 ,
112- "translated" : 11 ,
113- "fuzzy" : 1 ,
114- "untranslated" : 0 ,
115- "percentage" : 91.67
116- }
10+ "CONTRIBUTING" : {
11+ "total" : 124 ,
12+ "translated" : 0 ,
13+ "fuzzy" : 0 ,
14+ "untranslated" : 124 ,
15+ "percentage" : 0.0
16+ },
17+ "documentation" : {
18+ "total" : 9 ,
19+ "translated" : 8 ,
20+ "fuzzy" : 1 ,
21+ "untranslated" : 0 ,
22+ "percentage" : 88.89
23+ },
24+ "index" : {
25+ "total" : 14 ,
26+ "translated" : 11 ,
27+ "fuzzy" : 1 ,
28+ "untranslated" : 2 ,
29+ "percentage" : 78.57
30+ },
31+ "package-structure-code" : {
32+ "total" : 131 ,
33+ "translated" : 126 ,
34+ "fuzzy" : 1 ,
35+ "untranslated" : 4 ,
36+ "percentage" : 96.18
37+ },
38+ "tests" : {
39+ "total" : 1 ,
40+ "translated" : 0 ,
41+ "fuzzy" : 1 ,
42+ "untranslated" : 0 ,
43+ "percentage" : 0.0
44+ },
45+ "TRANSLATING" : {
46+ "total" : 108 ,
47+ "translated" : 0 ,
48+ "fuzzy" : 0 ,
49+ "untranslated" : 108 ,
50+ "percentage" : 0.0
51+ },
52+ "tutorials" : {
53+ "total" : 12 ,
54+ "translated" : 11 ,
55+ "fuzzy" : 1 ,
56+ "untranslated" : 0 ,
57+ "percentage" : 91.67
58+ }
59+ },
60+ "ja" : {
61+ "continuous-integration" : {
62+ "total" : 38 ,
63+ "translated" : 38 ,
64+ "fuzzy" : 0 ,
65+ "untranslated" : 0 ,
66+ "percentage" : 100.0
67+ },
68+ "CONTRIBUTING" : {
69+ "total" : 124 ,
70+ "translated" : 124 ,
71+ "fuzzy" : 0 ,
72+ "untranslated" : 0 ,
73+ "percentage" : 100.0
74+ },
75+ "documentation" : {
76+ "total" : 468 ,
77+ "translated" : 467 ,
78+ "fuzzy" : 1 ,
79+ "untranslated" : 0 ,
80+ "percentage" : 99.79
81+ },
82+ "index" : {
83+ "total" : 14 ,
84+ "translated" : 11 ,
85+ "fuzzy" : 1 ,
86+ "untranslated" : 2 ,
87+ "percentage" : 78.57
88+ },
89+ "package-structure-code" : {
90+ "total" : 87 ,
91+ "translated" : 86 ,
92+ "fuzzy" : 1 ,
93+ "untranslated" : 0 ,
94+ "percentage" : 98.85
95+ },
96+ "tests" : {
97+ "total" : 1 ,
98+ "translated" : 0 ,
99+ "fuzzy" : 1 ,
100+ "untranslated" : 0 ,
101+ "percentage" : 0.0
102+ },
103+ "TRANSLATING" : {
104+ "total" : 25 ,
105+ "translated" : 24 ,
106+ "fuzzy" : 1 ,
107+ "untranslated" : 0 ,
108+ "percentage" : 96.0
109+ },
110+ "tutorials" : {
111+ "total" : 12 ,
112+ "translated" : 11 ,
113+ "fuzzy" : 1 ,
114+ "untranslated" : 0 ,
115+ "percentage" : 91.67
117116 }
118- }
117+ }
118+ }
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def calculate_translation_percentage(po_path : Path, locale : str) -> dict:
5757def main ():
5858 # Get all .po files in the locales directory
5959 po_files = list (LOCALES_DIR .rglob ("*.po" ))
60-
60+
6161 # Let's use a dictionary to store the results
6262 #
6363 # We will store the info as
@@ -83,24 +83,24 @@ def main():
8383 # ...
8484 # }
8585 results = {}
86-
86+
8787 # Calculate translation percentages for each file
8888 for po_file in po_files :
8989 # Get the locale from the file path
9090 locale = po_file .parent .parent .name
9191 stats = calculate_translation_percentage (po_file , locale )
9292 print (f"({ po_file .stem } ): { stats ['percentage' ]} % translated ({ stats ['translated' ]} of { stats ['total' ]} )" )
93-
93+
9494 # Store the results in the dictionary
9595 if locale not in results :
9696 results [locale ] = {}
97-
97+
9898 results [locale ][po_file .stem ] = stats
99-
99+
100100 # Dump the results to a JSON file
101101 with open (STATIC_DIR / "translation_stats.json" , "w" ) as f :
102102 import json
103103 json .dump (results , f , indent = 4 )
104104
105105if __name__ == "__main__" :
106- main ()
106+ main ()
You can’t perform that action at this time.
0 commit comments