Skip to content

Increase strictness and improve ability to keep internationalization tests up-to-date#10508

Merged
mitchellhenke merged 4 commits intomainfrom
mitchellhenke/improve-i18n-test-strictness
Apr 25, 2024
Merged

Increase strictness and improve ability to keep internationalization tests up-to-date#10508
mitchellhenke merged 4 commits intomainfrom
mitchellhenke/improve-i18n-test-strictness

Conversation

@mitchellhenke
Copy link
Contributor

🛠 Summary of changes

While working on #10291, I was working on some improvements to the i18n tests and pulled them out here to make them easier to review. This PR makes a few changes:

  • Check whether keys in ALLOWED_UNTRANSLATED_KEYS are used in untranslated keys test. It's kind of goofy to mutate the hashes in the constant and check it in the same test, but it was straightforward. I'm very open to suggestions here.
  • Similar to above, check whether ALLOWED_INTERPOLATION_MISMATCH_KEYS are all used

The above will hopefully help in keeping the list of exceptions up-to-date.

I've also made some smaller changes to the checks in allowed_untranslated_key? so that we don't use a Regexp unless it is explicitly one, and otherwise use strict equality.

…tests up-to-date

changelog: Internal, Internationalization, Increase strictness and improve ability to keep internationalization tests up-to-date
@mitchellhenke mitchellhenke requested a review from a team April 25, 2024 16:53
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swapped the conditionals here so that we only check whether a key is allowed to be untranslated in the case where we have a match on values. This removes some unnecessary checks and also helps with the tracking of unused allowed untranslated keys.

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/improve-i18n-test-strictness branch from f84d513 to 675e9ed Compare April 25, 2024 16:56
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@mitchellhenke mitchellhenke merged commit 947bbbf into main Apr 25, 2024
@mitchellhenke mitchellhenke deleted the mitchellhenke/improve-i18n-test-strictness branch April 25, 2024 17:46
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