Skip to content

Commit e638006

Browse files
committed
Correctly pluralize "version(s) since" on versions index page
From rubygems#4460 (comment) Added a test to verify this string is being pluralized properly. Also added every locale with varying degrees of confidence - es/pt-BR: I know enough to be fairly confident this is correct - ja: I know enough to be fairly confident this is correct and verified with native speaker - fr: I verified with native speaker - de/nl: I used online translation tools to check singular vs plural - zh-CN/zh-TW: I don't think they pluralize, but I just copied the existing string into both `other` and `one` which maintains behavior before this PR anyway.
1 parent a166302 commit e638006

File tree

10 files changed

+54
-9
lines changed

10 files changed

+54
-9
lines changed

config/locales/de.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,9 @@ de:
705705
index:
706706
not_hosted_notice: Dieses Gem wird nicht gerade von RubyGems.org gehostet.
707707
title: Alle Versionen von %{name}
708-
versions_since: "%{count} Versionen seit %{since}"
708+
versions_since:
709+
other: "%{count} Versionen seit %{since}"
710+
one: "%{count} Version seit %{since}"
709711
imported_gem_version_notice:
710712
version:
711713
yanked:

config/locales/en.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,9 @@ en:
707707
index:
708708
not_hosted_notice: This gem is not currently hosted on RubyGems.org.
709709
title: All versions of %{name}
710-
versions_since: "%{count} versions since %{since}"
710+
versions_since:
711+
other: "%{count} versions since %{since}"
712+
one: "1 version since %{since}"
711713
imported_gem_version_notice: "This gem version was imported to RubyGems.org on %{import_date}. The date displayed was specified by the author in the gemspec."
712714
version:
713715
yanked: yanked

config/locales/es.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,9 @@ es:
831831
index:
832832
not_hosted_notice: Esta gema no está alojada actualmente en RubyGems.org.
833833
title: Todas las versiones de %{name}
834-
versions_since: "%{count} versiones desde %{since}"
834+
versions_since:
835+
other: "%{count} versiones desde %{since}"
836+
one: "%{count} versión desde %{since}"
835837
imported_gem_version_notice: Esta versión de la gema se importó a RubyGems.org
836838
el %{import_date}. La fecha que se muestra fue especificada por el autor en
837839
el archivo gemspec.

config/locales/fr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,9 @@ fr:
755755
index:
756756
not_hosted_notice: Gem non hébergé sur Rubygems.
757757
title: Toutes les versions de %{name}
758-
versions_since: "%{count} versions depuis %{since}"
758+
versions_since:
759+
other: "%{count} versions depuis %{since}"
760+
one: "%{count} version depuis %{since}"
759761
imported_gem_version_notice:
760762
version:
761763
yanked: retiré

config/locales/ja.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,9 @@ ja:
713713
index:
714714
not_hosted_notice: このgemは現在RubyGems.org上ではホストされていません。
715715
title: "%{name}の全バージョン履歴"
716-
versions_since: "%{since}からの%{count}件"
716+
versions_since:
717+
other: "%{since}からの%{count}件"
718+
one: "%{since}からの%{count}件"
717719
imported_gem_version_notice: このgemのバージョンは%{import_date}にRubyGems.orgにインポートされました。表示されている日付は作者によってgemspec中で指定されました。
718720
version:
719721
yanked: ヤンク済み

config/locales/nl.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ nl:
709709
index:
710710
not_hosted_notice: Deze gem wordt momenteel niet gehost op rubygems.org
711711
title: Alle versies van %{name}
712-
versions_since: "%{count} versies sinds %{since}"
712+
versions_since:
713+
other: "%{count} versies sinds %{since}"
714+
one: "%{count} versie sinds %{since}"
713715
imported_gem_version_notice:
714716
version:
715717
yanked: verwijderd

config/locales/pt-BR.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,9 @@ pt-BR:
732732
index:
733733
not_hosted_notice: Esta gem não está hospdada no Gemcutter.
734734
title: Todas as versões para %{name}
735-
versions_since: "%{count} versões desde %{since}"
735+
versions_since:
736+
other: "%{count} versões desde %{since}"
737+
one: "%{count} versão desde %{since}"
736738
imported_gem_version_notice:
737739
version:
738740
yanked: removida

config/locales/zh-CN.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ zh-CN:
720720
index:
721721
not_hosted_notice: 此 Gem 目前没有托管在 RubyGems.org 中。
722722
title: "%{name} 的所有版本"
723-
versions_since: 自 %{since} 以来有 %{count} 个版本
723+
versions_since:
724+
other: 自 %{since} 以来有 %{count} 个版本
725+
one: 自 %{since} 以来有 %{count} 个版本
724726
imported_gem_version_notice: 此版本的 Gem 已在 %{import_date} 导入到 RubyGems.org 中。显示的日期由作者在
725727
gemspec 中指定。
726728
version:

config/locales/zh-TW.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,9 @@ zh-TW:
692692
index:
693693
not_hosted_notice: 這個 Gem 目前沒有在 Gemcutter 上
694694
title: "%{name} 的所有版本"
695-
versions_since: 自從 %{since} 以來,有 %{count} 個版本
695+
versions_since:
696+
other: 自從 %{since} 以來,有 %{count} 個版本
697+
one: 自從 %{since} 以來,有 %{count} 個版本
696698
imported_gem_version_notice:
697699
version:
698700
yanked: 已被移除

test/functional/versions_controller_test.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@ class VersionsControllerTest < ActionController::TestCase
6464
end
6565
end
6666

67+
context "on GET to index - pluralization" do
68+
context "with one version" do
69+
setup do
70+
rubygem = create(:rubygem)
71+
create(:version, number: "1.1.2", rubygem: rubygem)
72+
get :index, params: { rubygem_id: rubygem.name }
73+
end
74+
75+
should "use the singular version" do
76+
assert_select ".t-list__heading", text: /1 version\b/, count: 1
77+
end
78+
end
79+
80+
context "with two versions" do
81+
setup do
82+
rubygem = create(:rubygem)
83+
create(:version, number: "1.1.2", rubygem: rubygem)
84+
create(:version, number: "1.1.3", rubygem: rubygem)
85+
get :index, params: { rubygem_id: rubygem.name }
86+
end
87+
88+
should "use the plural version" do
89+
assert_select ".t-list__heading", text: /2 versions\b/, count: 1
90+
end
91+
end
92+
end
93+
6794
context "on GET to index with imported versions" do
6895
setup do
6996
@built_at = Date.parse("2000-01-01")

0 commit comments

Comments
 (0)