Skip to content

Use defaultdict on suppress_warning to simplify empty lists - #3549

Merged
tupaschoal merged 1 commit into
OpenRCT2:masterfrom
tupaschoal:simplify_suppressions
Sep 29, 2026
Merged

tupaschoal merged 1 commit into
OpenRCT2:masterfrom
tupaschoal:simplify_suppressions

Conversation

@tupaschoal

@tupaschoal tupaschoal commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

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

Will help the follow-up of #3432

Without this patch, adding a new language and running translation_check.py would yield:

PS C:\GitHub\Localisation> python .github/workflows/translation_check.py --reference-lang-file ..\OpenRCT2\data\language\en-GB.txt --master-dir .\data\language --branch-dir .\data\language\
Traceback (most recent call last):
  File "C:\GitHub\Localisation\.github\workflows\translation_check.py", line 245, in <module>
    run()
  File "C:\GitHub\Localisation\.github\workflows\translation_check.py", line 195, in run
    prepare_translation_report(args.master_dir, args.branch_dir, args.reference_lang_file, args.github_run_url)
  File "C:\GitHub\Localisation\.github\workflows\translation_check.py", line 200, in prepare_translation_report
    master_branch = count_translations(master_dir, False, reference_file)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\GitHub\Localisation\.github\workflows\translation_check.py", line 138, in count_translations
    if base_string in KEYS_TO_IGNORE and base_string not in SUPPRESS_WARNING[lang]:
                                                            ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'hi-IN'

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
@tupaschoal
tupaschoal marked this pull request as ready for review September 26, 2026 10:47
@tupaschoal
tupaschoal merged commit 6f2cf0f into OpenRCT2:master Sep 29, 2026
@tupaschoal
tupaschoal deleted the simplify_suppressions branch September 29, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants