1
- import json
2
1
import os
3
2
import traceback
4
3
from datetime import datetime
@@ -132,28 +131,32 @@ def get_project_translators(self, project_name: str) -> dict:
132
131
def generate_md_file (data : dict ) -> None :
133
132
"""Generate a markdown file for the dashboard."""
134
133
script_path = Path (__file__ ).resolve ()
135
- parent_dir = script_path .parent .parent / ' content'
136
- content = ''' ---
134
+ parent_dir = script_path .parent .parent / " content"
135
+ content = """ ---
137
136
title: Translations Status
138
137
draft: false
139
138
---
140
- '''
139
+ """
141
140
new_file_path = parent_dir / "status.md"
142
141
for crowdin_project in sorted (data , key = lambda x : x .lower ()):
143
142
project_id = data [crowdin_project ]["project_id" ]
144
143
content += f"\n ## { crowdin_project } \n "
145
- content += """\n <table>
144
+ content += """\n <table class="dashboard" >
146
145
<tr>
147
- <th>Language</th>
148
- <th>Translators</th>
149
- <th>Completion %</th>
150
- <th>Approval %</th>
146
+ <th align="center" >Language</th>
147
+ <th align="center" >Translators</th>
148
+ <th align="center" >Completion %</th>
149
+ <th align="center" >Approval %</th>
151
150
</tr>
152
151
"""
153
152
status = data [crowdin_project ]["status" ]
154
- for language_id , _ in sorted (status .items (), key = lambda item : (item [1 ]['progress' ], item [1 ]['approval' ]), reverse = True ):
153
+ for language_id , _ in sorted (
154
+ status .items (),
155
+ key = lambda item : (item [1 ]["progress" ], item [1 ]["approval" ]),
156
+ reverse = True ,
157
+ ):
155
158
print (language_id )
156
- url = f' https://scientific-python.crowdin.com/u/projects/{ project_id } /l/{ language_id } '
159
+ url = f" https://scientific-python.crowdin.com/u/projects/{ project_id } /l/{ language_id } "
157
160
content += f"""<tr>
158
161
<td><a href='{ url } '>{ data [crowdin_project ]['status' ][language_id ]['language_name' ]} ({ language_id } )</a></td>
159
162
<td>{ len (data [crowdin_project ]['translators' ][language_id ])} </td>
@@ -163,7 +166,7 @@ def generate_md_file(data: dict) -> None:
163
166
164
167
content += "\n </table>\n \n "
165
168
166
- content += f"\n \n ---\n \n Last updated: { datetime .now ().strftime ('%Y-%m-%d %H:%M:%S ' )} \n "
169
+ content += f"\n \n ---\n \n Last updated: { datetime .now ().strftime ('%Y-%m-%d' )} \n "
167
170
168
171
with open (new_file_path , "w" ) as f :
169
172
f .write (content )
0 commit comments