Skip to content

Commit 38c7299

Browse files
committed
Update to center tables
1 parent 3d944d8 commit 38c7299

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

scripts/update_dashboard.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import os
32
import traceback
43
from datetime import datetime
@@ -132,28 +131,32 @@ def get_project_translators(self, project_name: str) -> dict:
132131
def 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 = """---
137136
title: Translations Status
138137
draft: 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\nLast updated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
169+
content += f"\n\n---\n\nLast 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

Comments
 (0)