1- import json
21import os
32import traceback
43from datetime import datetime
@@ -132,28 +131,32 @@ def get_project_translators(self, project_name: str) -> dict:
132131def generate_md_file (data : dict ) -> None :
133132 """Generate a markdown file for the dashboard."""
134133 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 = """ ---
137136title: Translations Status
138137draft: false
139138---
140- '''
139+ """
141140 new_file_path = parent_dir / "status.md"
142141 for crowdin_project in sorted (data , key = lambda x : x .lower ()):
143142 project_id = data [crowdin_project ]["project_id" ]
144143 content += f"\n ## { crowdin_project } \n "
145- content += """\n <table>
144+ content += """\n <table class="dashboard" >
146145<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>
151150</tr>
152151"""
153152 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+ ):
155158 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 } "
157160 content += f"""<tr>
158161<td><a href='{ url } '>{ data [crowdin_project ]['status' ][language_id ]['language_name' ]} ({ language_id } )</a></td>
159162<td>{ len (data [crowdin_project ]['translators' ][language_id ])} </td>
@@ -163,7 +166,7 @@ def generate_md_file(data: dict) -> None:
163166
164167 content += "\n </table>\n \n "
165168
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 "
167170
168171 with open (new_file_path , "w" ) as f :
169172 f .write (content )
0 commit comments