File tree 2 files changed +121
-121
lines changed
2 files changed +121
-121
lines changed Original file line number Diff line number Diff line change 1
1
{
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
59
9
},
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
117
116
}
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:
57
57
def main ():
58
58
# Get all .po files in the locales directory
59
59
po_files = list (LOCALES_DIR .rglob ("*.po" ))
60
-
60
+
61
61
# Let's use a dictionary to store the results
62
62
#
63
63
# We will store the info as
@@ -83,24 +83,24 @@ def main():
83
83
# ...
84
84
# }
85
85
results = {}
86
-
86
+
87
87
# Calculate translation percentages for each file
88
88
for po_file in po_files :
89
89
# Get the locale from the file path
90
90
locale = po_file .parent .parent .name
91
91
stats = calculate_translation_percentage (po_file , locale )
92
92
print (f"({ po_file .stem } ): { stats ['percentage' ]} % translated ({ stats ['translated' ]} of { stats ['total' ]} )" )
93
-
93
+
94
94
# Store the results in the dictionary
95
95
if locale not in results :
96
96
results [locale ] = {}
97
-
97
+
98
98
results [locale ][po_file .stem ] = stats
99
-
99
+
100
100
# Dump the results to a JSON file
101
101
with open (STATIC_DIR / "translation_stats.json" , "w" ) as f :
102
102
import json
103
103
json .dump (results , f , indent = 4 )
104
104
105
105
if __name__ == "__main__" :
106
- main ()
106
+ main ()
You can’t perform that action at this time.
0 commit comments