rails-i18n 7.0.5 → 7.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -2
  3. data/README.md +48 -12
  4. data/lib/rails_i18n/common_pluralizations/east_slavic.rb +2 -2
  5. data/lib/rails_i18n/common_pluralizations/one_few_other.rb +2 -1
  6. data/lib/rails_i18n/common_pluralizations/one_other.rb +1 -1
  7. data/lib/rails_i18n/common_pluralizations/one_two_other.rb +5 -7
  8. data/lib/rails_i18n/common_pluralizations/one_upto_two_other.rb +4 -2
  9. data/lib/rails_i18n/common_pluralizations/one_with_zero_other.rb +6 -1
  10. data/lib/rails_i18n/common_pluralizations/romanian.rb +5 -2
  11. data/lib/rails_i18n/common_pluralizations/west_slavic.rb +4 -6
  12. data/lib/rails_i18n/railtie.rb +9 -4
  13. data/lib/rails_i18n.rb +10 -0
  14. data/rails/locale/af.yml +19 -19
  15. data/rails/locale/az.yml +12 -12
  16. data/rails/locale/bg.yml +12 -12
  17. data/rails/locale/bn.yml +19 -19
  18. data/rails/locale/bs.yml +6 -6
  19. data/rails/locale/ca.yml +17 -17
  20. data/rails/locale/cy.yml +80 -75
  21. data/rails/locale/da.yml +3 -3
  22. data/rails/locale/de-AT.yml +7 -4
  23. data/rails/locale/de-CH.yml +7 -4
  24. data/rails/locale/de-DE.yml +7 -4
  25. data/rails/locale/de.yml +7 -4
  26. data/rails/locale/dz.yml +213 -0
  27. data/rails/locale/el-CY.yml +9 -9
  28. data/rails/locale/el.yml +9 -9
  29. data/rails/locale/en-AU.yml +15 -15
  30. data/rails/locale/en-CA.yml +15 -15
  31. data/rails/locale/en-CY.yml +15 -15
  32. data/rails/locale/en-GB.yml +15 -15
  33. data/rails/locale/en-IE.yml +15 -15
  34. data/rails/locale/en-IN.yml +15 -15
  35. data/rails/locale/en-NZ.yml +15 -15
  36. data/rails/locale/en-TT.yml +15 -15
  37. data/rails/locale/en-US.yml +15 -15
  38. data/rails/locale/en-ZA.yml +18 -18
  39. data/rails/locale/en.yml +17 -15
  40. data/rails/locale/eo.yml +5 -5
  41. data/rails/locale/es-419.yml +17 -16
  42. data/rails/locale/es-AR.yml +17 -16
  43. data/rails/locale/es-CL.yml +17 -16
  44. data/rails/locale/es-CO.yml +17 -16
  45. data/rails/locale/es-CR.yml +17 -16
  46. data/rails/locale/es-EC.yml +17 -16
  47. data/rails/locale/es-ES.yml +17 -16
  48. data/rails/locale/es-MX.yml +17 -16
  49. data/rails/locale/es-NI.yml +17 -16
  50. data/rails/locale/es-PA.yml +17 -16
  51. data/rails/locale/es-PE.yml +17 -16
  52. data/rails/locale/es-US.yml +17 -16
  53. data/rails/locale/es-VE.yml +17 -16
  54. data/rails/locale/es.yml +20 -18
  55. data/rails/locale/eu.yml +4 -4
  56. data/rails/locale/fa.yml +2 -2
  57. data/rails/locale/fi.yml +3 -3
  58. data/rails/locale/fr-CA.yml +10 -8
  59. data/rails/locale/fr-CH.yml +10 -8
  60. data/rails/locale/fr-FR.yml +10 -8
  61. data/rails/locale/fr.yml +12 -10
  62. data/rails/locale/gd.yml +252 -0
  63. data/rails/locale/gl.yml +10 -10
  64. data/rails/locale/hi-IN.yml +2 -2
  65. data/rails/locale/hi.yml +2 -2
  66. data/rails/locale/hr.yml +46 -46
  67. data/rails/locale/hu.yml +12 -12
  68. data/rails/locale/id.yml +7 -7
  69. data/rails/locale/is.yml +14 -14
  70. data/rails/locale/it-CH.yml +10 -10
  71. data/rails/locale/it.yml +9 -9
  72. data/rails/locale/ja.yml +15 -39
  73. data/rails/locale/ka.yml +16 -16
  74. data/rails/locale/kn.yml +5 -5
  75. data/rails/locale/ko.yml +30 -56
  76. data/rails/locale/lb.yml +7 -7
  77. data/rails/locale/lo.yml +13 -85
  78. data/rails/locale/lv.yml +11 -1
  79. data/rails/locale/mg.yml +6 -6
  80. data/rails/locale/ml.yml +11 -11
  81. data/rails/locale/mn.yml +15 -15
  82. data/rails/locale/mr-IN.yml +2 -2
  83. data/rails/locale/ms.yml +13 -13
  84. data/rails/locale/nb.yml +16 -16
  85. data/rails/locale/ne.yml +15 -15
  86. data/rails/locale/nl.yml +7 -7
  87. data/rails/locale/nn.yml +10 -10
  88. data/rails/locale/oc.yml +1 -1
  89. data/rails/locale/or.yml +12 -12
  90. data/rails/locale/pa.yml +15 -15
  91. data/rails/locale/pap-AW.yml +16 -16
  92. data/rails/locale/pap-CW.yml +16 -16
  93. data/rails/locale/pl.yml +4 -4
  94. data/rails/locale/pt-BR.yml +18 -17
  95. data/rails/locale/pt.yml +15 -14
  96. data/rails/locale/rm.yml +2 -2
  97. data/rails/locale/ro.yml +6 -6
  98. data/rails/locale/ru.yml +17 -15
  99. data/rails/locale/sc.yml +223 -0
  100. data/rails/locale/sl.yml +10 -10
  101. data/rails/locale/sq.yml +15 -19
  102. data/rails/locale/sv-FI.yml +207 -0
  103. data/rails/locale/sv-SE.yml +4 -1
  104. data/rails/locale/sv.yml +4 -1
  105. data/rails/locale/sw.yml +9 -9
  106. data/rails/locale/ta.yml +10 -10
  107. data/rails/locale/tr.yml +16 -16
  108. data/rails/locale/uz.yml +1 -1
  109. data/rails/locale/vi.yml +13 -37
  110. data/rails/locale/wo.yml +15 -15
  111. data/rails/locale/zh-CN.yml +30 -30
  112. data/rails/locale/zh-HK.yml +28 -60
  113. data/rails/locale/zh-TW.yml +30 -62
  114. data/rails/locale/zh-YUE.yml +23 -55
  115. data/rails/ordinals/de-AT.rb +15 -0
  116. data/rails/ordinals/de-CH.rb +15 -0
  117. data/rails/ordinals/de-DE.rb +15 -0
  118. data/rails/ordinals/de.rb +15 -0
  119. data/rails/ordinals/gd.rb +24 -0
  120. data/rails/pluralization/ar.rb +3 -2
  121. data/rails/pluralization/el-CY.rb +3 -0
  122. data/rails/pluralization/en-CY.rb +3 -0
  123. data/rails/pluralization/en-IE.rb +3 -0
  124. data/rails/pluralization/en-TT.rb +3 -0
  125. data/rails/pluralization/en-US.rb +3 -0
  126. data/rails/pluralization/en-ZA.rb +3 -0
  127. data/rails/pluralization/gd.rb +8 -4
  128. data/rails/pluralization/hsb.rb +7 -9
  129. data/rails/pluralization/lt.rb +3 -2
  130. data/rails/pluralization/lv.rb +1 -2
  131. data/rails/pluralization/mk.rb +2 -3
  132. data/rails/pluralization/pl.rb +4 -3
  133. data/rails/pluralization/sc.rb +3 -0
  134. data/rails/pluralization/sl.rb +7 -11
  135. data/rails/transliteration/de.yml +1 -0
  136. metadata +18 -49
  137. data/rails/pluralization/ak.rb +0 -3
  138. data/rails/pluralization/am.rb +0 -3
  139. data/rails/pluralization/bh.rb +0 -3
  140. data/rails/pluralization/bm.rb +0 -3
  141. data/rails/pluralization/bo.rb +0 -3
  142. data/rails/pluralization/br.rb +0 -31
  143. data/rails/pluralization/by.rb +0 -3
  144. data/rails/pluralization/cy.rb +0 -24
  145. data/rails/pluralization/dz.rb +0 -3
  146. data/rails/pluralization/ff.rb +0 -3
  147. data/rails/pluralization/ga.rb +0 -27
  148. data/rails/pluralization/guw.rb +0 -3
  149. data/rails/pluralization/gv.rb +0 -22
  150. data/rails/pluralization/ig.rb +0 -3
  151. data/rails/pluralization/ii.rb +0 -3
  152. data/rails/pluralization/iu.rb +0 -3
  153. data/rails/pluralization/jv.rb +0 -3
  154. data/rails/pluralization/kab.rb +0 -3
  155. data/rails/pluralization/kde.rb +0 -3
  156. data/rails/pluralization/kea.rb +0 -3
  157. data/rails/pluralization/ksh.rb +0 -23
  158. data/rails/pluralization/kw.rb +0 -3
  159. data/rails/pluralization/lag.rb +0 -24
  160. data/rails/pluralization/ln.rb +0 -3
  161. data/rails/pluralization/mo.rb +0 -3
  162. data/rails/pluralization/mt.rb +0 -28
  163. data/rails/pluralization/my.rb +0 -3
  164. data/rails/pluralization/naq.rb +0 -3
  165. data/rails/pluralization/nso.rb +0 -3
  166. data/rails/pluralization/root.rb +0 -3
  167. data/rails/pluralization/sah.rb +0 -3
  168. data/rails/pluralization/se.rb +0 -3
  169. data/rails/pluralization/ses.rb +0 -3
  170. data/rails/pluralization/sg.rb +0 -3
  171. data/rails/pluralization/sh.rb +0 -3
  172. data/rails/pluralization/shi.rb +0 -3
  173. data/rails/pluralization/sma.rb +0 -3
  174. data/rails/pluralization/smi.rb +0 -3
  175. data/rails/pluralization/smj.rb +0 -3
  176. data/rails/pluralization/smn.rb +0 -3
  177. data/rails/pluralization/sms.rb +0 -3
  178. data/rails/pluralization/ti.rb +0 -3
  179. data/rails/pluralization/to.rb +0 -3
  180. data/rails/pluralization/tzm.rb +0 -21
  181. data/rails/pluralization/wa.rb +0 -3
  182. data/rails/pluralization/yo.rb +0 -3
  183. data/rails/pluralization/zh.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef7cee06deda3f23eeb1c88e22c6c84705d1c13df6b93692142d694e658fd7f7
4
- data.tar.gz: 7fabe1deed31d62c9715fc22a884072d4ea50e1d1eb283f9956e073ffd573c79
3
+ metadata.gz: 4b6b63235eb4a6a2008be34a7fc2f9d68c982bdc149cc1584b07be4a47df32e3
4
+ data.tar.gz: 3233aea32115ecdd2a32b70d869a156f07623d4c1bb754ea05de0f8ea44d7ccb
5
5
  SHA512:
6
- metadata.gz: 95859f3f8678e70e4480f7076298082ab77f497aa7c659928fe09ffd824e9d2220a984283cdaebc8a679213cb0c185899a6371cf2f8654a8e89cb8bc2339cd47
7
- data.tar.gz: 6876dc5a2e2243fa86e5a13b45e72cf9c9d26099847fb051423ce42020045f8486acbc1a3028851dce5fc57da3f6edc3720ce48aa222d98255ca391902dae885
6
+ metadata.gz: e28e003e6f7c797f8d4885ea8aa6edf15ff6c7b0be06ff7f18ed351dae7ccc54782bf4f6cc7879e9b8c8dbeac6db21c61523d88c8ec1dd4c9e927d2cb3e7ab00
7
+ data.tar.gz: ef5f52b3d499b64449e099ed65d97b9638dc31f3027dc461234252485695728a9d1d0766624db2104b5a84007d95d8e21b4e9d3b9b285f4cf7fbf3f27a5859a8
data/CHANGELOG.md CHANGED
@@ -1,6 +1,82 @@
1
- ## unreleased
1
+ ## 7.0.7 (2022-05-12)
2
2
 
3
- - Remove eager loading of translations during boot phase (this is now done by Rails).
3
+ - Non-numerics counts are considered as `other` in all pluralizations #1067
4
+ - Update following locales:
5
+ - Afrikaan (af): ZAR currency format #1066
6
+ - English (en-ZA): ZAR currency format #1066
7
+ - German (de, de-DE, de-AT, de-CH): Use abbreviated months in the short time format #1062
8
+ - Japanese (ja): Add `in` and `round_mode` keys #1059
9
+ - Korean (ko): Fix typo in `equal_to` keys #1061
10
+ - Portuguese (pt, pt-BR): add translation for `errors.messages.in` #1071
11
+ - Scottish Gaelic (gd): Add locale
12
+ - Russian (ru): fix some errors in 'datetime' section, add `errors.messages.in` and `number.format.round_mode` keys #1077
13
+ - Spanish (es): add translation for `errors.messages.in` #1071
14
+ - French (fr, fr-CA, fr-CH, fr-FR): fix typo on 'almost_x_years: one' #1074
15
+ - Indonesian (id): Remove duplicate spaces in `id.datetime.distance_in_words.less_than_x_minutes.other` #1079
16
+ - Romanian (ro): Correction of Saturday in Romanian #1078
17
+ - Croatian (hr): use lowercase for month and weekday names #1081
18
+ - Add ordinalization for German (de, de-AT, de-CH, de-DE)
19
+ - Remove keys that are present twice from Latvian (lv), Albanian (sq) #1080
20
+
21
+ ## 7.0.6 (2022-11-08)
22
+
23
+ - Add option to choose which modules (locales, pluralization, transliteration,
24
+ ordinals) are enabled #1019
25
+ - Add following locales:
26
+ - Dzongkha (dz) #1052
27
+ - Sardinian (sc) #1030
28
+ - Swedish (sv-FI): Finland’s native Swedish-speakers #1055
29
+ - Update following locales:
30
+ - Bengali (bn): Fix date and spelling issues #1031
31
+ - Chinese (zh-HK, zh-TW, zh-YUE, zh-CN):
32
+ - Simplify pluralization #1032 #1033 #1036
33
+ - Standardize punctuation #997
34
+ - English (en, en-CY, en-IE, en-TT, en-US, en-ZA):
35
+ - Add pluralization #1021
36
+ - Add `in` and `round_mode` keys #1042
37
+ - French (fr, fr-CA, fr-CH, fr-CA):
38
+ - Change an abreviation for March month in abbr_month_names #1002
39
+ - Add `in` and `round_mode` keys #1046
40
+ - Galician (gl): Add missing accent on `incluído` #961
41
+ - German (de-AT, de-CH, de-DE, de):
42
+ - Add transliteration rule for `ẞ` #1025
43
+ - Add `eb` and `pb` storage units #1043
44
+ - Add `round_mode` key #1044
45
+ - Greek (el-CY): Add pluralization #1022
46
+ - Japanese (ja): Simplify pluralization #1038
47
+ - Korean (ko):
48
+ - Language improvements #989
49
+ - Simplify pluralization #1037
50
+ - Latvian (lv): Add multiple missing translations #966
51
+ - Spanish (es, es-419, es-AR, es-CL, es-CO, es-CR, es-ES, es-MX, es-NI, es-PA,
52
+ es-PE, es-US, es-VE): Add `round_mode` key #1045
53
+ - Swedish (sv-SE): Adjust precision and add some missing keys #1047
54
+ - Vietnamese (vi):
55
+ - Update translation for taken #1009
56
+ - Simplify pluralization #1035
57
+ - Removed pluralizations rules that do not have locale files: ak, am, bh, bm,
58
+ bo, br, by, cy, dz, ff, ga, gd, guw, gv, ig, ii, iu, jv, kab, kde, kea, ksh,
59
+ kw, lag, ln, mo, mt, my, naq, nso, root, sah, se, ses, sg, sh, shi, sma, smi,
60
+ smj, smn, sms, ti, to, tzm, wa, yo, zh #1017
61
+ - Change instances of the `one` pluralization key to use `%{count}` interpolation #993
62
+
63
+ ## 7.0.5 (2022-07-03)
64
+
65
+ - No changes.
66
+
67
+ ## 7.0.4 (2022-07-03)
68
+
69
+ - Add following locales:
70
+ - Western Frisian (fy) #985
71
+ - Kazakh (kk) #945
72
+ - Update following locales:
73
+ - Slovak (sk): Fixed missing message #994
74
+ - French (fr): Revert remainder of NBSP characters #996
75
+ - French (fr): Use no-padded date format #991
76
+ - Arabic (ar): fix errors.messages.greater_than typo #998
77
+ - South slavic pluralizers #987
78
+ - Update update.rb to fetch active_model locale #1000
79
+ - Remove eager loading of translations during boot phase (this is now done by Rails). #983
4
80
 
5
81
  ## 7.0.3 (2022-03-01)
6
82
 
data/README.md CHANGED
@@ -35,6 +35,31 @@ Note that your Ruby on Rails version must be 3.0 or higher in order to install t
35
35
 
36
36
  ## Configuration
37
37
 
38
+ ### Enabled modules
39
+
40
+ By default, all `rails-i18n` modules (locales, pluralization, transliteration, ordinals) are enabled.
41
+
42
+ If you would like to only enable specific modules, you can do so in your Rails configuration:
43
+
44
+ ```ruby
45
+ # to enable only pluralization rules, but disable all other features
46
+ config.rails_i18n.enabled_modules = [:pluralization]
47
+
48
+ # to enable pluralization and ordinals
49
+ config.rails_i18n.enabled_modules = [:pluralization, :ordinals]
50
+ ```
51
+
52
+ The possible module names:
53
+
54
+ * `:locale`
55
+ * `:ordinals`
56
+ * `:pluralization`
57
+ * `:transliteration`
58
+
59
+ Setting `enabled_modules` will restrict the gem's loaded features to only the specific types.
60
+
61
+ ### Available locales
62
+
38
63
  `rails-i18n` gem initially loads all available locale files, pluralization and transliteration rules. This default behaviour can be changed. If you specify in `config/environments/*` the locales which have to be loaded via `I18n.available_locales` option:
39
64
 
40
65
  ``` ruby
@@ -61,21 +86,32 @@ Locale data whose structure is compatible with Rails 2.3 are available on the se
61
86
 
62
87
  ## Available Locales
63
88
 
64
- Available locales:
89
+ **Available locales:**
90
+
91
+ af, ar, az, be, bg, bn, bs, ca, cs, csb, da, de, de-AT, de-CH, de-DE, dsb, dz, el, el-CY, en, en-AU, en-CA, en-CY, en-GB, en-IE, en-IN, en-NZ, en-TT, en-US, en-ZA, eo, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, et, eu, fa, fi, fr, fr-CA, fr-CH, fr-FR, fur, fy, gl, gsw-CH, he, hi, hi-IN, hr, hsb, hu, id, is, it, it-CH, ja, ka, kk, km, kn, ko, lb, lo, lt, lv, mg, mk, ml, mn, mr-IN, ms, nb, ne, nl, nn, oc, or, pa, pap-AW, pap-CW, pl, pt, pt-BR, rm, ro, ru, sc, scr, sk, sl, sq, sr, st, sv, sv-FI, sv-SE, sw, ta, te, th, tl, tr, tt, ug, uk, ur, uz, vi, wo, zh-CN, zh-HK, zh-TW, zh-YUE
92
+
93
+ **Complete locales:**
94
+
95
+ da, de, de-AT, de-CH, de-DE, en-US, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, et, fa, fr, fr-CA, fr-CH, fr-FR, fy, id, it, ja, ka, ml, nb, nl, nn, pt, pt-BR, sv, sv-SE, tr, zh-CN, zh-HK, zh-TW, zh-YUE, uk
96
+
97
+ **Locales with missing pluralization rules**
98
+
99
+ af, csb, dsb, fur, gsw-CH, lb, rm, scr, sq, te, tt, ug, uz
100
+
101
+ **Removed locales:**
102
+
103
+ cy
104
+
105
+ The cy locale was removed in commit 84f6c6b9b7a3e50df2b1fb1ccf7add329f7eab4f since unfortunately we could not find a Welsh speaker to support it.
106
+ We would welcome contributions to add it back to the project.
107
+ The locale is mostly complete for the missing translations please refer to [#1006](https://github.com/svenfuchs/rails-i18n/issues/1006)
108
+
109
+ **Removed pluralizations:**
65
110
 
66
- > af, ar, az, be, bg, bn, bs, ca, cs, cy, da, de, de-AT, de-CH, de-DE, el, el-CY,
67
- > en, en-AU, en-CA, en-GB, en-IE, en-IN, en-NZ, en-US, en-ZA, en-CY, en-TT, eo, es,
68
- > es-419, es-AR, es-CL, es-CO, es-CR, es-EC, es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE,
69
- > et, eu, fa, fi, fr, fr-CA, fr-CH, fr-FR, fy, gl, he, hi, hi-IN, hr, hu, id, is, it,
70
- > it-CH, ja, ka, km, kn, ko, lb, lo, lt, lv, mk, ml, mn, mr-IN, ms, nb, ne, nl, nn, oc, or,
71
- > pa, pl, pt, pt-BR, rm, ro, ru, sk, sl, sq, sr, st, sw, ta, te, th, tl, tr, tt, ug,
72
- > ur, uz, vi, wo, zh-CN, zh-HK, zh-TW, zh-YUE
111
+ ak, am, bh, bm, bo, br, by, cy, dz, ff, ga, gd, guw, gv, ig, ii, iu, jv, kab, kde, kea, ksh, kw, lag, ln, mo, mt, my, naq, nso, root, sah, se, ses, sg, sh, shi, sma, smi, smj, smn, sms, ti, to, tzm, wa, yo, zh
73
112
 
74
- Complete locales:
113
+ The above pluralization rules were removed because they did not have corresponding locale files.
75
114
 
76
- > af, da, de, de-AT, de-CH, de-DE, en-US, es, es-419, es-AR, es-CL, es-CO, es-CR, es-EC,
77
- > es-ES, es-MX, es-NI, es-PA, es-PE, es-US, es-VE, et, fa, fr, fr-CA, fr-CH, fr-FR, fy, id, it, ja, ka, ml, nb,
78
- > nl, nn, pt, pt-BR, sv, sv-SE, tr, zh-CN, zh-HK, zh-TW, zh-YUE, uk
79
115
 
80
116
  Currently, most locales are incomplete. Typically they lack the following keys:
81
117
 
@@ -6,7 +6,6 @@
6
6
  module RailsI18n
7
7
  module Pluralization
8
8
  module EastSlavic
9
-
10
9
  FROM_2_TO_4 = (2..4).to_a.freeze
11
10
  FROM_5_TO_9 = (5..9).to_a.freeze
12
11
  FROM_11_TO_14 = (11..14).to_a.freeze
@@ -14,7 +13,8 @@ module RailsI18n
14
13
 
15
14
  def self.rule
16
15
  lambda do |n|
17
- n ||= 0
16
+ return :other unless n.is_a?(Numeric)
17
+
18
18
  mod10 = n % 10
19
19
  mod100 = n % 100
20
20
 
@@ -6,7 +6,8 @@ module RailsI18n
6
6
 
7
7
  def self.rule
8
8
  lambda do |n|
9
- n ||= 0
9
+ return :other unless n.is_a?(Numeric)
10
+
10
11
  frac = (n.to_d % 1)
11
12
 
12
13
  if frac.nonzero?
@@ -16,4 +16,4 @@ module RailsI18n
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
@@ -6,12 +6,10 @@ module RailsI18n
6
6
  module OneTwoOther
7
7
  def self.rule
8
8
  lambda do |n|
9
- if n == 1
10
- :one
11
- elsif n == 2
12
- :two
13
- else
14
- :other
9
+ case n
10
+ when 1 then :one
11
+ when 2 then :two
12
+ else :other
15
13
  end
16
14
  end
17
15
  end
@@ -25,4 +23,4 @@ module RailsI18n
25
23
  end
26
24
  end
27
25
  end
28
- end
26
+ end
@@ -4,7 +4,9 @@ module RailsI18n
4
4
  module Pluralization
5
5
  module OneUptoTwoOther
6
6
  def self.rule
7
- lambda { |n| n && n >= 0 && n < 2 ? :one : :other }
7
+ lambda do |n|
8
+ n.is_a?(Numeric) && n >= 0 && n < 2 ? :one : :other
9
+ end
8
10
  end
9
11
 
10
12
  def self.with_locale(locale)
@@ -16,4 +18,4 @@ module RailsI18n
16
18
  end
17
19
  end
18
20
  end
19
- end
21
+ end
@@ -5,7 +5,12 @@ module RailsI18n
5
5
  module Pluralization
6
6
  module OneWithZeroOther
7
7
  def self.rule
8
- lambda { |n| n == 0 || n == 1 ? :one : :other }
8
+ lambda do |n|
9
+ case n
10
+ when 0, 1 then :one
11
+ else :other
12
+ end
13
+ end
9
14
  end
10
15
 
11
16
  def self.with_locale(locale)
@@ -3,12 +3,15 @@
3
3
  module RailsI18n
4
4
  module Pluralization
5
5
  module Romanian
6
+ FROM_1_TO_19 = (1..19).to_a.freeze
7
+
6
8
  def self.rule
7
9
  lambda do |n|
8
- n ||= 0
10
+ return :other unless n.is_a?(Numeric)
11
+
9
12
  if n == 1
10
13
  :one
11
- elsif n == 0 || (1..19).to_a.include?(n % 100)
14
+ elsif n == 0 || FROM_1_TO_19.include?(n % 100)
12
15
  :few
13
16
  else
14
17
  :other
@@ -5,12 +5,10 @@ module RailsI18n
5
5
  module WestSlavic
6
6
  def self.rule
7
7
  lambda do |n|
8
- if n == 1
9
- :one
10
- elsif [2, 3, 4].include?(n)
11
- :few
12
- else
13
- :other
8
+ case n
9
+ when 1 then :one
10
+ when 2, 3, 4 then :few
11
+ else :other
14
12
  end
15
13
  end
16
14
  end
@@ -2,14 +2,19 @@ require 'rails'
2
2
 
3
3
  module RailsI18n
4
4
  class Railtie < ::Rails::Railtie #:nodoc:
5
+ config.rails_i18n = RailsI18n
6
+
5
7
  initializer 'rails-i18n' do |app|
6
8
  RailsI18n::Railtie.instance_eval do
7
9
  pattern = pattern_from app.config.i18n.available_locales
8
10
 
9
- add("rails/locale/#{pattern}.yml")
10
- add("rails/pluralization/#{pattern}.rb")
11
- add("rails/ordinals/#{pattern}.rb")
12
- add("rails/transliteration/#{pattern}.{rb,yml}")
11
+ if app.config.rails_i18n.enabled_modules.empty?
12
+ RailsI18n.enabled_modules = Set.new([:locale, :pluralization, :ordinals, :transliteration])
13
+ end
14
+
15
+ RailsI18n.enabled_modules.each do |feature|
16
+ add("rails/#{feature}/#{pattern}.{rb,yml}")
17
+ end
13
18
 
14
19
  init_pluralization_module
15
20
  end
data/lib/rails_i18n.rb CHANGED
@@ -1 +1,11 @@
1
+ module RailsI18n
2
+ def self.enabled_modules
3
+ @enabled_modules ||= Set.new
4
+ end
5
+
6
+ def self.enabled_modules=(other)
7
+ @enabled_modules = Set.new(other)
8
+ end
9
+ end
10
+
1
11
  require 'rails_i18n/railtie'
data/rails/locale/af.yml CHANGED
@@ -63,41 +63,41 @@ af:
63
63
  datetime:
64
64
  distance_in_words:
65
65
  about_x_hours:
66
- one: ongeveer 1 uur
66
+ one: ongeveer %{count} uur
67
67
  other: ongeveer %{count} ure
68
68
  about_x_months:
69
- one: ongeveer 1 maand
69
+ one: ongeveer %{count} maand
70
70
  other: ongeveer %{count} maande
71
71
  about_x_years:
72
- one: ongeveer 1 jaar
72
+ one: ongeveer %{count} jaar
73
73
  other: ongeveer %{count} jaar
74
74
  almost_x_years:
75
- one: sowat 1 jaar
75
+ one: sowat %{count} jaar
76
76
  other: sowat %{count} jaar
77
77
  half_a_minute: halfminuut
78
78
  less_than_x_seconds:
79
- one: minder as 1 sekonde
79
+ one: minder as %{count} sekonde
80
80
  other: minder as %{count} sekondes
81
81
  less_than_x_minutes:
82
- one: minder as 1 minuut
82
+ one: minder as %{count} minuut
83
83
  other: minder as %{count} minute
84
84
  over_x_years:
85
- one: meer as 1 jaar
85
+ one: meer as %{count} jaar
86
86
  other: meer as %{count} jaar
87
87
  x_seconds:
88
- one: 1 sekonde
88
+ one: "%{count} sekonde"
89
89
  other: "%{count} sekondes"
90
90
  x_minutes:
91
- one: 1 minuut
91
+ one: "%{count} minuut"
92
92
  other: "%{count} minute"
93
93
  x_days:
94
- one: 1 dag
94
+ one: "%{count} dag"
95
95
  other: "%{count} days"
96
96
  x_months:
97
- one: 1 maand
97
+ one: "%{count} maand"
98
98
  other: "%{count} maande"
99
99
  x_years:
100
- one: 1 jaar
100
+ one: "%{count} jaar"
101
101
  other: "%{count} jare"
102
102
  prompts:
103
103
  second: Sekondes
@@ -131,18 +131,18 @@ af:
131
131
  required: moet bestaan
132
132
  taken: is reeds geneem
133
133
  too_long:
134
- one: is te lank (maksimum is 1 karakter)
134
+ one: is te lank (maksimum is %{count} karakter)
135
135
  other: is te lank (maksimum is %{count} karakters)
136
136
  too_short:
137
- one: is te kort (minimum is 1 karakter)
137
+ one: is te kort (minimum is %{count} karakter)
138
138
  other: is te kort (minimum is %{count} karakters)
139
139
  wrong_length:
140
- one: is die verkeerde lengte (moet 1 karakter wees)
140
+ one: is die verkeerde lengte (moet %{count} karakter wees)
141
141
  other: is die verkeerde lengte (moet %{count} karakters wees)
142
142
  template:
143
143
  body: 'There were problems with the following fields:'
144
144
  header:
145
- one: 1 fout het verhoed dat hierdie %{model} gestoor kon word
145
+ one: "%{count} fout het verhoed dat hierdie %{model} gestoor kon word"
146
146
  other: "%{count} foute het verhoed dat hierdie %{model} gestoor kon word"
147
147
  helpers:
148
148
  select:
@@ -154,10 +154,10 @@ af:
154
154
  number:
155
155
  currency:
156
156
  format:
157
- delimiter: ","
158
- format: "%u%n"
157
+ delimiter: " "
158
+ format: "%u %n"
159
159
  precision: 2
160
- separator: "."
160
+ separator: ","
161
161
  significant: false
162
162
  strip_insignificant_zeros: false
163
163
  unit: R
data/rails/locale/az.yml CHANGED
@@ -63,38 +63,38 @@ az:
63
63
  datetime:
64
64
  distance_in_words:
65
65
  about_x_hours:
66
- one: təxminən 1 saat
66
+ one: təxminən %{count} saat
67
67
  other: təxminən %{count} saat
68
68
  about_x_months:
69
- one: təxminən 1 ay
69
+ one: təxminən %{count} ay
70
70
  other: təxminən %{count} ay
71
71
  about_x_years:
72
- one: təxminən 1 il
72
+ one: təxminən %{count} il
73
73
  other: təxminən %{count} il
74
74
  almost_x_years:
75
- one: təqribən 1 il
75
+ one: təqribən %{count} il
76
76
  other: təqribən %{count} il
77
77
  half_a_minute: yarım dəqiqə
78
78
  less_than_x_seconds:
79
- one: 1 saniyədən az
79
+ one: "%{count} saniyədən az"
80
80
  other: "%{count} saniyədən az"
81
81
  less_than_x_minutes:
82
- one: 1 dəqiqədən az
82
+ one: "%{count} dəqiqədən az"
83
83
  other: "%{count} dəqiqədən az"
84
84
  over_x_years:
85
- one: 1 ildən çox
85
+ one: "%{count} ildən çox"
86
86
  other: "%{count} ildən çox"
87
87
  x_seconds:
88
- one: 1 saniyə
88
+ one: "%{count} saniyə"
89
89
  other: "%{count} saniyə"
90
90
  x_minutes:
91
- one: 1 dəqiqə
91
+ one: "%{count} dəqiqə"
92
92
  other: "%{count} dəqiqə"
93
93
  x_days:
94
- one: 1 gün
94
+ one: "%{count} gün"
95
95
  other: "%{count} gün"
96
96
  x_months:
97
- one: 1 ay
97
+ one: "%{count} ay"
98
98
  other: "%{count} ay"
99
99
  prompts:
100
100
  second: Saniyə
@@ -133,7 +133,7 @@ az:
133
133
  template:
134
134
  body: 'Aşağıdaki səhvlər üzə çıxdı:'
135
135
  header:
136
- one: "%{model} saxlanmadı: 1 səhv"
136
+ one: "%{model} saxlanmadı: %{count} səhv"
137
137
  other: "%{model} saxlanmadı: %{count} səhv"
138
138
  helpers:
139
139
  select:
data/rails/locale/bg.yml CHANGED
@@ -60,38 +60,38 @@ bg:
60
60
  datetime:
61
61
  distance_in_words:
62
62
  about_x_hours:
63
- one: около 1 час
63
+ one: около %{count} час
64
64
  other: около %{count} часа
65
65
  about_x_months:
66
- one: около 1 месец
66
+ one: около %{count} месец
67
67
  other: около %{count} месеца
68
68
  about_x_years:
69
- one: около 1 година
69
+ one: около %{count} година
70
70
  other: около %{count} години
71
71
  almost_x_years:
72
- one: почти 1 година
72
+ one: почти %{count} година
73
73
  other: почти %{count} години
74
74
  half_a_minute: половин минута
75
75
  less_than_x_seconds:
76
- one: по-малко от 1 секунда
76
+ one: по-малко от %{count} секунда
77
77
  other: по-малко от %{count} секунди
78
78
  less_than_x_minutes:
79
- one: по-малко от 1 минута
79
+ one: по-малко от %{count} минута
80
80
  other: по-малко от %{count} минути
81
81
  over_x_years:
82
- one: над 1 година
82
+ one: над %{count} година
83
83
  other: над %{count} години
84
84
  x_seconds:
85
- one: 1 секунда
85
+ one: "%{count} секунда"
86
86
  other: "%{count} секунди"
87
87
  x_minutes:
88
- one: 1 минута
88
+ one: "%{count} минута"
89
89
  other: "%{count} минути"
90
90
  x_days:
91
- one: 1 ден
91
+ one: "%{count} ден"
92
92
  other: "%{count} дни"
93
93
  x_months:
94
- one: 1 месец
94
+ one: "%{count} месец"
95
95
  other: "%{count} месеца"
96
96
  prompts:
97
97
  second: Секунда
@@ -126,7 +126,7 @@ bg:
126
126
  template:
127
127
  body: 'Възникнаха проблеми със следните полета:'
128
128
  header:
129
- one: "%{model}: записът е неуспешен заради 1 грешка"
129
+ one: "%{model}: записът е неуспешен заради %{count} грешка"
130
130
  other: "%{model}: записът е неуспешен заради %{count} грешки"
131
131
  helpers:
132
132
  select:
data/rails/locale/bn.yml CHANGED
@@ -18,7 +18,7 @@ bn:
18
18
  - মে
19
19
  - জুন
20
20
  - জুলাই
21
- - অগাস্ট
21
+ - আগস্ট
22
22
  - সেপ্টেম্বর
23
23
  - অক্টোবর
24
24
  - নভেম্বর
@@ -33,8 +33,8 @@ bn:
33
33
  - শনিবার
34
34
  formats:
35
35
  default: "%e/%m/%Y"
36
- long: "%e de %B de %Y"
37
- short: "%e de %b"
36
+ long: "%e %B %Y"
37
+ short: "%e %b"
38
38
  month_names:
39
39
  -
40
40
  - জানুয়ারি
@@ -44,7 +44,7 @@ bn:
44
44
  - মে
45
45
  - জুন
46
46
  - জুলাই
47
- - অগাস্ট
47
+ - আগস্ট
48
48
  - সেপ্টেম্বর
49
49
  - অক্টোবর
50
50
  - নভেম্বর
@@ -56,17 +56,17 @@ bn:
56
56
  datetime:
57
57
  distance_in_words:
58
58
  about_x_hours:
59
- one: প্রায় ১ ঘন্টা
60
- other: প্রায় %{count} ঘন্টা
59
+ one: প্রায় ১ ঘণ্টা
60
+ other: প্রায় %{count} ঘণ্টা
61
61
  about_x_months:
62
62
  one: প্রায় ১ মাস
63
63
  other: প্রায় %{count} মাস
64
64
  about_x_years:
65
65
  one: প্রায় ১ বছর
66
66
  other: প্রায় %{count} বছর
67
- half_a_minute: অর্ধেক মিনিট
67
+ half_a_minute: অর্ধ মিনিট
68
68
  less_than_x_seconds:
69
- one: '১ সেকেন্ডর কম '
69
+ one: '১ সেকেন্ডর কম'
70
70
  other: "%{count} সেকেন্ডের কম"
71
71
  less_than_x_minutes:
72
72
  one: ১ মিনিটের কম
@@ -89,7 +89,7 @@ bn:
89
89
  prompts:
90
90
  second: সেকেন্ড
91
91
  minute: মিনিট
92
- hour: ঘন্টা
92
+ hour: ঘণ্টা
93
93
  day: দিন
94
94
  month: মাস
95
95
  year: বছর
@@ -103,9 +103,9 @@ bn:
103
103
  equal_to: "%{count} এর সঙ্গে সমান হতে হবে"
104
104
  even: জোড় হতে হবে
105
105
  exclusion: রিসার্ভ করা আছে
106
- greater_than: "%{count} থেকে বড়ো হতে হবে"
107
- greater_than_or_equal_to: "%{count} থেকে বড়ো অথবা তার সমান হতে হবে"
108
- inclusion: লিস্টে অন্তর্ভুক্ত নয়
106
+ greater_than: "%{count} থেকে বড় হতে হবে"
107
+ greater_than_or_equal_to: "%{count} থেকে বড় অথবা তার সমান হতে হবে"
108
+ inclusion: তালিকায় অন্তর্ভুক্ত নয়
109
109
  invalid: সঠিক নয়
110
110
  less_than: "%{count} থেকে ছোটো হতে হবে"
111
111
  less_than_or_equal_to: "%{count} থেকে ছোটো অথবা তার সমান হতে হবে"
@@ -118,8 +118,8 @@ bn:
118
118
  template:
119
119
  body: 'এই ফিল্ডগুলোতে কিছু সমস্যা দেখা দিয়েছে:'
120
120
  header:
121
- one: টি ত্রুটির কারনে %{model} সংরক্ষন করা সম্ভব হয়নি
122
- other: "%{count} টি ত্রুটির কারনে %{model} সংরক্ষন করা সম্ভব হয়নি"
121
+ one: ১টি ত্রুটির কারণে %{model} সংরক্ষণ করা সম্ভব হয়নি
122
+ other: "%{count}টি ত্রুটির কারণে %{model} সংরক্ষণ করা সম্ভব হয়নি"
123
123
  number:
124
124
  currency:
125
125
  format:
@@ -150,8 +150,8 @@ bn:
150
150
  format: "%n %u"
151
151
  units:
152
152
  byte:
153
- one: Byte
154
- other: Bytes
153
+ one: বাইট
154
+ other: বাইট
155
155
  gb: GB
156
156
  kb: KB
157
157
  mb: MB
@@ -170,7 +170,7 @@ bn:
170
170
  time:
171
171
  am: am
172
172
  formats:
173
- default: "%A, %e de %B de %Y %H:%M:%S %z"
174
- long: "%e de %B de %Y %H:%M"
175
- short: "%e de %b %H:%M"
173
+ default: "%A, %e %B %Y %H:%M:%S %z"
174
+ long: "%e %B %Y %H:%M"
175
+ short: "%e %b %H:%M"
176
176
  pm: pm