FIX: Add missing pluralization keys to poll plugin locale

This commit is contained in:
Gerhard Schlager 2015-09-27 21:36:57 +02:00
parent 193f04842e
commit bb52042b46
4 changed files with 18 additions and 8 deletions

View File

@ -29,9 +29,15 @@ en:
multiple:
help:
at_least_min_options: "You must choose at least <strong>%{count}</strong> options."
up_to_max_options: "You may choose up to <strong>%{count}</strong> options."
x_options: "You must choose <strong>%{count}</strong> options."
at_least_min_options:
one: "You must choose at least <strong>1</strong> option."
other: "You must choose at least <strong>%{count}</strong> options."
up_to_max_options:
one: "You may choose up to <strong>1</strong> option."
other: "You may choose up to <strong>%{count}</strong> options."
x_options:
one: "You must choose <strong>1</strong> option."
other: "You must choose <strong>%{count}</strong> options."
between_min_and_max_options: "You may choose between <strong>%{min}</strong> and <strong>%{max}</strong> options."
cast-votes:

View File

@ -26,8 +26,12 @@ en:
default_poll_must_have_at_least_2_options: "Poll must have at least 2 options."
named_poll_must_have_at_least_2_options: "Poll named <strong>%{name}</strong> must have at least 2 options."
default_poll_must_have_less_options: "Poll must have less than %{max} options."
named_poll_must_have_less_options: "Poll named <strong>%{name}</strong> must have less than %{max} options."
default_poll_must_have_less_options:
one: "Poll must have less than 1 option."
other: "Poll must have less than %{count} options."
named_poll_must_have_less_options:
one: "Poll named <strong>%{name}</strong> must have less than 1 option."
other: "Poll named <strong>%{name}</strong> must have less than %{count} options."
default_poll_must_have_different_options: "Poll must have different options."
named_poll_must_have_different_options: "Poll named <strong>%{name}</strong> must have different options."

View File

@ -257,8 +257,8 @@ after_initialize do
# maximum # of options
if poll["options"].size > SiteSetting.poll_maximum_options
poll["name"] == DEFAULT_POLL_NAME ?
self.errors.add(:base, I18n.t("poll.default_poll_must_have_less_options", max: SiteSetting.poll_maximum_options)) :
self.errors.add(:base, I18n.t("poll.named_poll_must_have_less_options", name: poll["name"], max: SiteSetting.poll_maximum_options))
self.errors.add(:base, I18n.t("poll.default_poll_must_have_less_options", count: SiteSetting.poll_maximum_options)) :
self.errors.add(:base, I18n.t("poll.named_poll_must_have_less_options", name: poll["name"], count: SiteSetting.poll_maximum_options))
return
end

View File

@ -50,7 +50,7 @@ describe PostsController do
expect(response).not_to be_success
json = ::JSON.parse(response.body)
expect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_less_options", max: SiteSetting.poll_maximum_options))
expect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_less_options", count: SiteSetting.poll_maximum_options))
end
it "should have valid parameters" do