Closed Roko131 closed 1 year ago
Thanks for opening this issue! I'll add a zero
onto those keys.
hmmm, I'm having trouble reproducing this. Those helpers don't require a zero
for me, so I'm a little confused about why your setup would 🤔
Doing a little research, it seems like the i18n gem asserts pluralize
"...will pick the :zero subkey in the special case where count is equal to 0 and there is a :zero subkey present."
Which matches up with the code:
😕 So I'm not sure why your application is specifically expecting a zero
key. Are there other I18n-related gems that you're using or something that has been patched into your application?
Edit: this also matches up with the Rails translation docs too: https://guides.rubyonrails.org/i18n.html#pluralization
The translation denoted as :one is regarded as singular, and the :other is used as plural. If the count is zero, and a :zero entry is present, then it will be used instead of :other.
You are correct, it is specifically related to my application configuration- my bad.
This is the culprit:
config/locales/plurals.rb
:
{:en =>
{ :i18n =>
{ :plural =>
{ :keys => [:zero, :one, :other],
:rule => lambda { |n|
if n == 1
:one
elsif n == 0
:zero
else
:other
end
}
}
}
}
}
Hi, getting:
translation data {:one=>"Apply to all 1 job.", :other=>"Apply to all %{count} jobs."} can not be used with :count => 0. key 'zero' is missing.
When clicking : for example clicking 0 queued jobs
Because no
zero
value at apply to all (at any of the languages): https://github.com/bensheldon/good_job/blob/7971c8febdca9ee76555ec756e1257c34da4cd9a/config/locales/en.yml#L130-L134 So need to either addzero
in all translations languages or adjust line 54 :t ".actions.apply_to_all", count: filter.filtered_count
and somehow avoidcount
being zerohttps://github.com/bensheldon/good_job/blob/7971c8febdca9ee76555ec756e1257c34da4cd9a/app/views/good_job/jobs/_table.erb#L48-L57