Skip to content

Improve failure message for unused allowed untranslated keys test#10574

Merged
mitchellhenke merged 3 commits intomainfrom
mitchellhenke/more-helpful-i18n-unused-exception-error-message
May 8, 2024
Merged

Improve failure message for unused allowed untranslated keys test#10574
mitchellhenke merged 3 commits intomainfrom
mitchellhenke/more-helpful-i18n-unused-exception-error-message

Conversation

@mitchellhenke
Copy link
Contributor

@mitchellhenke mitchellhenke commented May 8, 2024

🛠 Summary of changes

This PR makes a small proposed change to the error message around unused allowed untranslated keys from #10508 to give clearer instructions on the source of the failure and how to resolve it.

Old message:

     Failure/Error:
       expect(unused_allowed_untranslated_keys).to(
         be_empty,
         "unused allowed untranslated i18n keys: #{unused_allowed_untranslated_keys}",
       )

       unused allowed untranslated i18n keys: [{:key=>"titles.piv_cac_setup.upsell", :locales=>[:fr]}, {:key=>"titles.piv_cac_setup.upsell", :locales=>[:es]}]

Proposed message:

     Failure/Error:
           expect(unused_allowed_untranslated_keys).to(
             be_empty,
             <<~EOS,
               ALLOWED_UNTRANSLATED_KEYS contains unused allowed untranslated i18n keys.
               The following keys can be removed from ALLOWED_UNTRANSLATED_KEYS:
               #{unused_allowed_untranslated_keys.pretty_inspect}
             EOS
           )

       ALLOWED_UNTRANSLATED_KEYS contains unused allowed untranslated i18n keys.
       The following keys can be removed from ALLOWED_UNTRANSLATED_KEYS:
       [{:key=>"titles.piv_cac_setup.upsell", :locales=>[:fr]},
        {:key=>"titles.piv_cac_setup.upsell", :locales=>[:es]}]

changelog: Internal, Tests, Improve test message for unused allowed untranslated keys
@mitchellhenke mitchellhenke requested review from a team and KeithNava May 8, 2024 19:09
Mitchell Henke and others added 2 commits May 8, 2024 14:21
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/more-helpful-i18n-unused-exception-error-message branch from 1d42fe8 to cf1c5c9 Compare May 8, 2024 19:31
Copy link
Contributor

@KeithNava KeithNava left a comment

Choose a reason for hiding this comment

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

🔥

@mitchellhenke mitchellhenke merged commit 050cca7 into main May 8, 2024
@mitchellhenke mitchellhenke deleted the mitchellhenke/more-helpful-i18n-unused-exception-error-message branch May 8, 2024 20:11
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.

3 participants