Prevent community mods from warning on unused translations in the common assets#21503
Merged
PunkPun merged 1 commit intoOpenRA:bleedfrom Jul 28, 2024
Merged
Prevent community mods from warning on unused translations in the common assets#21503PunkPun merged 1 commit intoOpenRA:bleedfrom
PunkPun merged 1 commit intoOpenRA:bleedfrom
Conversation
…mon assets Currently when linting translations, we check for any unused translation keys. This works fine for the default mods, which own the entire sets of translation files. For community mods, they often import the translation files from the common mod assets, but they may only use some of the translations provided. Currently, they would get warnings about not using translations from the common files they have imported. Since the community mods don't own those translations, getting warnings about it is annoying. To solve this issue, introduce a AllowUnusedTranslationsInExternalPackages in the mod.yaml which defaults to true. This will prevent reporting of unused translation keys from external assets. Keys that are used for external assets will still be validated, and keys from the mod assets will be both validated and unused keys will be reported. We default the new flag to true and don't provide an update rule. This means community mods will get the new behaviour. For the default mods, we do want to check the "external" assets, since we control those assets. So the default mods have their mod.yaml updated to disable the flag and retain the existing behaviour of checking everything.
Member
|
Approach looks sensible to me in the short-mid term. In the longer term we need to move the |
PunkPun
approved these changes
Jul 28, 2024
Member
PunkPun
left a comment
There was a problem hiding this comment.
LGTM, should be tested with an SDK mod
Member
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently when linting translations, we check for any unused translation keys. This works fine for the default mods, which own the entire sets of translation files. For community mods, they often import the translation files from the common mod assets, but they may only use some of the translations provided. Currently, they would get warnings about not using translations from the common files they have imported.
Since the community mods don't own those translations, getting warnings about it is annoying. To solve this issue, introduce a AllowUnusedTranslationsInExternalPackages in the mod.yaml which defaults to true. This will prevent reporting of unused translation keys from external assets. Keys that are used for external assets will still be validated, and keys from the mod assets will be both validated and unused keys will be reported.
We default the new flag to true and don't provide an update rule. This means community mods will get the new behaviour. For the default mods, we do want to check the "external" assets, since we control those assets. So the default mods have their mod.yaml updated to disable the flag and retain the existing behaviour of checking everything.
Fixes #20693
To test, add an unused translation key into e.g.
mods\ra\languages\rules\en.ftland another intomods\common\languages\rules\en.ftl.When running the utility command
ra --check-yaml, you will see two warnings reported - because for the default mods we still want to report on unused keys in common.If you then update the
mods\ra\mod.yamlto disable or remove theAllowUnusedTranslationsInExternalPackagesentry and rerun the utility, you will see only the one warning reported from therafile. This is the behaviour that community mods would get by default.