Skip to content

Commit 52d48ac

Browse files
author
Éric Araujo
committed
rework things
- move logic from template to code - use list instead of decorative characters (style tbd) - use aria labels to distinguish identical links
1 parent c918d08 commit 52d48ac

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

contribute.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ def get_contrib_link(language: str, repo: str | None) -> str | None:
2222
and 'https://explore.transifex.com/python-doc/python-newest/'
2323
)
2424
or (repo and f'https://github.com/{repo}')
25+
or 'https://devguide.python.org/documentation/translations/translating/'
2526
)

generate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def get_project_data(
8181
change,
8282
built,
8383
translated_name=languages_built.get(language.code, ''),
84-
uses_platform=language.code in contribute.pulling_from_transifex,
8584
contribution_link=contribute.get_contrib_link(language.code, repo),
8685
)
8786

@@ -95,7 +94,6 @@ class LanguageProjectData:
9594
change: float
9695
built: bool
9796
translated_name: str
98-
uses_platform: bool
9997
contribution_link: str | None
10098

10199

templates/index.html.jinja

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@
1313
<p class="text-muted">30-day progress: {{ '{:.2f}%'.format(project.change) }}</p>
1414

1515
<p style="text-align: center;">
16+
<ul class="links-row">
1617
{% if project.built %}
17-
<a href="https://docs.python.org/{{ project.language.code }}/3/" style="color: #1178cc;">View {{ project.language.name }}</a>
18-
19-
{% endif %}
20-
{% if project.contribution_link %}
21-
<a href="{{ project.contribution_link }}" style="color: #1178cc;">Contribute</a>
22-
{% elif project.uses_platform %}
23-
<a href="https://app.transifex.com/join/?o=python-doc&p=python-newest&t=opensource" style="color: #1178cc;">Contribute to {{ project.language.name }}</a>
24-
{% else %}
25-
<a href="https://devguide.python.org/documentation/translations/translating/" style="color: #1178cc;">Contribute to {{ project.language.name }}</a>
18+
<li>
19+
<a href="https://docs.python.org/{{ project.language.code }}/3/" aria-label="View {{ project.language.name }} documentation"
20+
style="color: #1178cc;">View</a>
21+
</li>
2622
{% endif %}
23+
<li>
24+
<a href="{{ project.contribution_link }}" style="color: #1178cc;" aria-label="Contribute to {{ project.language.name }} translation">
25+
Contribute
26+
</a>
27+
</li>
28+
</ul>
2729
</p>
2830
<div class="progress-bar-container">
2931
<div class="progress-bar" style="width: {{ project.completion }}%;

0 commit comments

Comments
 (0)