Skip to content

Commit

Permalink
Website: move empty languages to own table (home-assistant#2527)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Nov 13, 2024
1 parent 909736d commit ca3d97b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 5 deletions.
14 changes: 14 additions & 0 deletions script/intentfest/website_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

def run() -> int:
language_summaries = {}
empty_languages = []

language_info = yaml.safe_load(LANGUAGES_FILE.read_text())

Expand Down Expand Up @@ -55,6 +56,18 @@ def run() -> int:
for translation in merged_sentences["responses"]["errors"].values()
)

completely_empty = sum(intent_sentence_count.values()) == 0

if completely_empty:
empty_languages.append(
{
"language": language,
"native_name": language_info[language]["nativeName"],
"leaders": language_info[language].get("leaders"),
}
)
continue

missing_intents = [
intent for intent in IMPORTANT_INTENTS if not intent_sentence_count[intent]
]
Expand Down Expand Up @@ -108,6 +121,7 @@ def run() -> int:
)
if info["missing_intents"]
],
"empty_languages": empty_languages,
},
indent=2,
)
Expand Down
51 changes: 46 additions & 5 deletions website/src-11ty/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@
</tbody>
</table>
<p><i>Every cell in the table links to the relevant file.</i></p>

<h2>Road to Team 💚</h2>
List of languages that are missing important intent coverage.
<table>
<tr>
<th>Language</th>
<th>Missing</th>
<th>Intents</th>
</tr>
<thead>
<tr>
<th>Language</th>
<th>Missing</th>
<th>Intents</th>
</tr>
</thead>
{% for language in intentSummary.improvements %}
<tr>
<td>{{ language }}</td>
Expand All @@ -119,3 +122,41 @@ <h2>Road to Team 💚</h2>
</tr>
{% endfor %}
</table>

<h2>Empty language files</h2>
<table>
<thead>
<tr>
<th>Language</th>
<th>Leader</th>
</tr>
</thead>
{% for summary in intentSummary.empty_languages %}
<tr>
<td>
<a
href="https://github.com/home-assistant/intents/blob/main/sentences/{{ summary.language }}/"
target="_blank"
>
<code>{{summary.language}}</code> {{summary.native_name}}
</a>
</td>
<td
class="{% if summary.leaders and (summary.leaders | len) > 1 %}multiple{% endif %}"
>
{% if summary.leaders %} {% for leader in summary.leaders %}
<a href="https://github.com/{{ leader }}" target="_blank">
@{{ leader }}
</a>
{% endfor %} {% else %}
<a
href="https://developers.home-assistant.io/docs/voice/language-leaders/"
target="_blank"
>
&lt;position open&gt;
</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>

0 comments on commit ca3d97b

Please sign in to comment.