diff --git a/.github/workflows/suppress_warning.py b/.github/workflows/suppress_warning.py new file mode 100644 index 0000000000..97b8550de2 --- /dev/null +++ b/.github/workflows/suppress_warning.py @@ -0,0 +1,48 @@ +""" +Dictionary of fields that should not appear in translation check warnings +per each language + +each maintainer kindly PR's STR_nnnn he has checked and found being reported +incorectly +""" + +SUPPRESS_WARNING = dict() +""" +This gets imported in translation_check.py, which checks it against all +languages present in 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 + +Example of population: +SUPPRESS_WARNING['qq-JJ'] = ['STR_0123', 'STR_5678', 'STR_8900'] +""" + +SUPPRESS_WARNING['ar-EG'] = [] +SUPPRESS_WARNING['ca-ES'] = [] +SUPPRESS_WARNING['cs-CZ'] = [] +SUPPRESS_WARNING['da-DK'] = [] +SUPPRESS_WARNING['de-DE'] = [] +SUPPRESS_WARNING['en-US'] = [] +SUPPRESS_WARNING['eo-ZZ'] = [] +SUPPRESS_WARNING['es-ES'] = [] +SUPPRESS_WARNING['fi-FI'] = [] +SUPPRESS_WARNING['fr-CA'] = [] +SUPPRESS_WARNING['fr-FR'] = [] +SUPPRESS_WARNING['gl-ES'] = [] +SUPPRESS_WARNING['hu-HU'] = [] +SUPPRESS_WARNING['it-IT'] = [] +SUPPRESS_WARNING['ja-JP'] = [] +SUPPRESS_WARNING['ko-KR'] = [] +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'] = [] diff --git a/.github/workflows/translation_check.py b/.github/workflows/translation_check.py index 46be43f6c7..57331b2e52 100644 --- a/.github/workflows/translation_check.py +++ b/.github/workflows/translation_check.py @@ -9,6 +9,8 @@ import os import re +from suppress_warning import SUPPRESS_WARNING + MASTER_LANG_DIR = "master/data/language" PR_LANG_DIR = "pr/data/language" OPENRCT2_EN_GB_FILE = "OpenRCT2/data/language/en-GB.txt" @@ -128,7 +130,7 @@ def count_translations(dir_with_translations, print_info, reference_file): } for base_string in en_gb: - if base_string in KEYS_TO_IGNORE: + if base_string in KEYS_TO_IGNORE and base_string not in SUPPRESS_WARNING[lang]: if base_string in translations and en_gb[base_string] != translations[base_string]: messages['unexpected'].append(base_string) elif base_string not in translations: @@ -148,8 +150,11 @@ def count_translations(dir_with_translations, print_info, reference_file): print(f'\t{', '.join(messages["missing"])}') print(f'Unnecessary (not in en-GB) ({not_needed[lang]}):') print(f'\t{', '.join(messages["unnecessary"])}') - print(f'Unexpected (should not be translated) ({len(messages["unexpected"])}):') + print(f'Technical strings modified ({len(messages["unexpected"])}):') print(f'\t{', '.join(messages["unexpected"])}') + if messages["unexpected"]: + print(f'\tIt\'s not expected for the above to be translated, but if it makes sense for your language,') + print(f'\tadd a waiver for them on suppress_warning.py and open a PR explaining why.') print(f'Same as en-GB ({same_counters[lang]}):') print(f'\t{', '.join(messages["same"])}') print(f'{"-" * 47}\n')