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

dashboard/engine – i18n: Wrong translation scope #605

Closed
Jay-Schneider opened this issue May 23, 2022 · 2 comments
Closed

dashboard/engine – i18n: Wrong translation scope #605

Jay-Schneider opened this issue May 23, 2022 · 2 comments

Comments

@Jay-Schneider
Copy link
Contributor

Hi there,

I encountered a problem when updating good_job from 2.14.2 to 2.15.0 regarding the hereby introduced internationalization.

The application I am running is configured to raise an exception instead of falling back to display the key in question.
When I visit the dashboard I receive a I18n::MissingTranslationData in GoodJob::Jobs#index stating translation missing: en.status.scheduled.

I figured out that this is actually a problem in the gem, where the view refers to scope: '.status' while the locale file actually has the translations nested under good_job.status (which might be the better choice here imho).

<% filter.states.each do |name, count| %>
<li class="nav-item">
<%= link_to url_for({state: name}), class: "nav-link #{"active" if params[:state] == name}" do %>
<%= t(name, scope: '.status') %>

good_job:
shared:
footer:
last_update_html: Last updated <time id="page-updated-at" datetime="%{time}">%{time}</time>
wording: Remember, you're doing a Good Job too!
navbar:
cron_schedules: Cron
jobs: Jobs
live_poll: Live Poll
name: "GoodJob 👍"
processes: Processes
status:
discarded: Discarded
finished: Finished
queued: Queued
retried: Retried
running: Running
scheduled: Scheduled

So maybe the fix just constists of adjusting to scope to .goodjob.status?

Additionally one might consider configuring i18n to raise during tests so that such mistakes are not concealed.

Best regards 👋

Jay-Schneider added a commit to Jay-Schneider/good_job that referenced this issue May 23, 2022
@bensheldon
Copy link
Owner

bensheldon commented May 23, 2022

@Jay-Schneider thanks for reporting this! You're correct, the scope should be good_job.status and that's a good suggestion to set the GoodJob test environment to raise on missing translations. Can you make a PR for that? (I see you have a commit already)

Jay-Schneider added a commit to Jay-Schneider/good_job that referenced this issue May 23, 2022
@bensheldon
Copy link
Owner

@Jay-Schneider This has been released in v2.5.1

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

No branches or pull requests

2 participants