Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Catch missing translations during test runs #26258

Merged
merged 4 commits into from
May 24, 2024

Conversation

Drenmi
Copy link
Contributor

@Drenmi Drenmi commented Mar 20, 2024

What is this change?

This configuration makes it so that a missing translation will raise an error during test execution. Better discover there than after deploy.

@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch from abceb02 to 78832c2 Compare March 20, 2024 06:59
@Drenmi Drenmi marked this pull request as ready for review March 20, 2024 07:00
@@ -122,7 +122,8 @@ def translate_no_override(key, options)
dup_options = nil
if options
dup_options = options.dup
should_raise = dup_options.delete(:raise)
should_raise =
dup_options.delete(:raise) || Rails.application.config.i18n.raise_on_missing_translations
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A little bit of coupling here, but that's because our freedom patch isn't made to work with the built-in exception handler, which is how the Railtie makes this connection normally.

@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch from d533949 to bc82ccd Compare April 8, 2024 03:28
@github-actions github-actions bot added the i18n PRs which update English locale files or i18n related code label Apr 8, 2024
@@ -282,7 +282,7 @@ def stub_empty_referred_topics_data
it "returns localized titles" do
stub_empty_referred_topics_data
expect(top_referred_topics[:title]).to be_present
expect(top_referred_topics[:xaxis]).to be_present
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason this was "present" is because it was a string: "Missing translation for ...", which misses the intent of the test.

@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch 9 times, most recently from b83afa1 to 800afe2 Compare April 8, 2024 06:00
@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch 2 times, most recently from f72614d to e9b3a52 Compare May 24, 2024 10:32
@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch from e9b3a52 to 85c679e Compare May 24, 2024 10:43
@Drenmi Drenmi force-pushed the dev/catch-missing-translations-during-test-runs branch from 85c679e to 0cf7bf5 Compare May 24, 2024 13:03
@Drenmi Drenmi merged commit 69205cb into main May 24, 2024
16 checks passed
@Drenmi Drenmi deleted the dev/catch-missing-translations-during-test-runs branch May 24, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n PRs which update English locale files or i18n related code
2 participants