From b17ef62049afdfb84b2074e6b186d2a68e06f47c Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 26 Sep 2026 07:47:18 -0300 Subject: [PATCH] Use defaultdict on suppress_warning to simplify empty lists This has two main benefits: - makes the file a lot simpler since we don't need to define the empty lists for languages without suppressions - new languages won't automatically fail the CI until someone merges an empty list into the master branch --- .github/workflows/suppress_warning.py | 43 ++++++++------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/.github/workflows/suppress_warning.py b/.github/workflows/suppress_warning.py index 718805d31a..f986af6634 100644 --- a/.github/workflows/suppress_warning.py +++ b/.github/workflows/suppress_warning.py @@ -1,51 +1,34 @@ """ Dictionary of fields that should not appear in translation check warnings -per each language +per each language. -each maintainer kindly PR's STR_nnnn he has checked and found being reported -incorectly +Each maintainer kindly PRs STR_nnnn they have checked and found being reported +incorrectly. """ -SUPPRESS_WARNING = dict() +from collections import defaultdict + +SUPPRESS_WARNING = defaultdict(list) """ This gets imported in translation_check.py, which checks it against all -languages present in repo. +languages present in the repo. -Please note: Failing to add new language in this dictionary will cause -KeyError being raised in translation_check.py and therefore it -will break GitHub Action job +Note: Missing languages are automatically handled via defaultdict, so you +only need to add entries here if a language has specific warnings to suppress. Example of population: SUPPRESS_WARNING['qq-JJ'] = ['STR_0123', 'STR_5678', 'STR_8900'] """ -SUPPRESS_WARNING['ar-EG'] = [] SUPPRESS_WARNING['ca-ES'] = ['STR_3247', 'STR_6651', 'STR_6689', 'STR_6744'] -SUPPRESS_WARNING['cs-CZ'] = [] -SUPPRESS_WARNING['da-DK'] = [] -SUPPRESS_WARNING['de-DE'] = [] -SUPPRESS_WARNING['en-US'] = [] + SUPPRESS_WARNING['eo-ZZ'] = ['STR_0839', 'STR_0840'] -SUPPRESS_WARNING['es-ES'] = [] -SUPPRESS_WARNING['fi-FI'] = [] -SUPPRESS_WARNING['fr-CA'] = [] + # fr-FR uses em dashes (—) instead of en dashes (-) for separators and must have a non-breaking space before colons SUPPRESS_WARNING['fr-FR'] = ['STR_1165', 'STR_1333', 'STR_1334', 'STR_2781', 'STR_6229', 'STR_6230', 'STR_6231'] -SUPPRESS_WARNING['gl-ES'] = [] + # hu-HU needs to change order of {STRINGID}s for news and research to translate them properly. SUPPRESS_WARNING['hu-HU'] = ['STR_2235', 'STR_2289'] -SUPPRESS_WARNING['it-IT'] = [] -SUPPRESS_WARNING['ja-JP'] = [] + # ko-KR needs to change order of {STRINGID}s for news and research to translate them properly. STR_1218, 1219 is changed by @AaronVanGeffen at 738e920. SUPPRESS_WARNING['ko-KR'] = ['STR_1218', 'STR_1219', 'STR_2235', 'STR_2289'] -SUPPRESS_WARNING['nb-NO'] = [] -SUPPRESS_WARNING['nl-NL'] = [] -SUPPRESS_WARNING['pl-PL'] = [] -SUPPRESS_WARNING['pt-BR'] = [] -SUPPRESS_WARNING['ru-RU'] = [] -SUPPRESS_WARNING['sv-SE'] = [] -SUPPRESS_WARNING['tr-TR'] = [] -SUPPRESS_WARNING['uk-UA'] = [] -SUPPRESS_WARNING['vi-VN'] = [] -SUPPRESS_WARNING['zh-CN'] = [] -SUPPRESS_WARNING['zh-TW'] = []