r18n-core 3.1.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +398 -0
  3. data/README.md +63 -47
  4. data/base/cy.yml +34 -0
  5. data/lib/r18n-core.rb +37 -38
  6. data/lib/r18n-core/filter_list.rb +21 -13
  7. data/lib/r18n-core/filters.rb +43 -48
  8. data/lib/r18n-core/helpers.rb +2 -2
  9. data/lib/r18n-core/i18n.rb +70 -78
  10. data/lib/r18n-core/locale.rb +137 -107
  11. data/lib/r18n-core/locales/af.rb +36 -0
  12. data/lib/r18n-core/locales/az.rb +38 -0
  13. data/lib/r18n-core/locales/bg.rb +29 -0
  14. data/{locales → lib/r18n-core/locales}/ca.rb +9 -6
  15. data/{locales → lib/r18n-core/locales}/cs.rb +15 -11
  16. data/lib/r18n-core/locales/cy.rb +50 -0
  17. data/{locales → lib/r18n-core/locales}/da.rb +10 -7
  18. data/lib/r18n-core/locales/de.rb +33 -0
  19. data/{locales → lib/r18n-core/locales}/en-au.rb +2 -2
  20. data/{locales → lib/r18n-core/locales}/en-gb.rb +2 -2
  21. data/{locales → lib/r18n-core/locales}/en-us.rb +4 -3
  22. data/lib/r18n-core/locales/en.rb +51 -0
  23. data/{locales → lib/r18n-core/locales}/eo.rb +6 -4
  24. data/lib/r18n-core/locales/es-cl.rb +16 -0
  25. data/{locales → lib/r18n-core/locales}/es-us.rb +5 -4
  26. data/{locales → lib/r18n-core/locales}/es.rb +7 -3
  27. data/{locales → lib/r18n-core/locales}/fa.rb +2 -2
  28. data/lib/r18n-core/locales/fi.rb +39 -0
  29. data/lib/r18n-core/locales/fr.rb +39 -0
  30. data/{locales → lib/r18n-core/locales}/gl.rb +5 -3
  31. data/{locales → lib/r18n-core/locales}/hr.rb +13 -10
  32. data/{locales → lib/r18n-core/locales}/hu.rb +10 -7
  33. data/{locales → lib/r18n-core/locales}/id.rb +8 -4
  34. data/lib/r18n-core/locales/it.rb +37 -0
  35. data/{locales → lib/r18n-core/locales}/ja.rb +5 -4
  36. data/{locales → lib/r18n-core/locales}/kk.rb +12 -8
  37. data/{locales → lib/r18n-core/locales}/ko.rb +0 -0
  38. data/lib/r18n-core/locales/lv.rb +46 -0
  39. data/lib/r18n-core/locales/mn.rb +30 -0
  40. data/{locales → lib/r18n-core/locales}/nb.rb +6 -4
  41. data/lib/r18n-core/locales/nl.rb +31 -0
  42. data/{locales → lib/r18n-core/locales}/no.rb +0 -0
  43. data/lib/r18n-core/locales/pl.rb +45 -0
  44. data/{locales → lib/r18n-core/locales}/pt-br.rb +1 -1
  45. data/lib/r18n-core/locales/pt.rb +37 -0
  46. data/lib/r18n-core/locales/ru.rb +46 -0
  47. data/{locales → lib/r18n-core/locales}/sk.rb +13 -9
  48. data/{locales → lib/r18n-core/locales}/sr-latn.rb +10 -8
  49. data/{locales → lib/r18n-core/locales}/sv-se.rb +7 -5
  50. data/lib/r18n-core/locales/th.rb +41 -0
  51. data/{locales → lib/r18n-core/locales}/tr.rb +7 -6
  52. data/lib/r18n-core/locales/uk.rb +31 -0
  53. data/lib/r18n-core/locales/vi.rb +37 -0
  54. data/{locales → lib/r18n-core/locales}/zh-cn.rb +2 -2
  55. data/{locales → lib/r18n-core/locales}/zh-tw.rb +4 -4
  56. data/{locales → lib/r18n-core/locales}/zh.rb +7 -4
  57. data/lib/r18n-core/translated.rb +38 -37
  58. data/lib/r18n-core/translated_string.rb +19 -8
  59. data/lib/r18n-core/translation.rb +24 -19
  60. data/lib/r18n-core/unsupported_locale.rb +14 -6
  61. data/lib/r18n-core/untranslated.rb +23 -7
  62. data/lib/r18n-core/utils.rb +19 -23
  63. data/lib/r18n-core/version.rb +1 -1
  64. data/lib/r18n-core/yaml_loader.rb +17 -13
  65. data/lib/r18n-core/yaml_methods.rb +3 -1
  66. metadata +245 -118
  67. data/.rspec +0 -1
  68. data/Rakefile +0 -13
  69. data/locales/af.rb +0 -32
  70. data/locales/az.rb +0 -34
  71. data/locales/bg.rb +0 -25
  72. data/locales/de.rb +0 -29
  73. data/locales/en.rb +0 -48
  74. data/locales/fi.rb +0 -35
  75. data/locales/fr.rb +0 -35
  76. data/locales/it.rb +0 -34
  77. data/locales/lv.rb +0 -41
  78. data/locales/mn.rb +0 -27
  79. data/locales/nl.rb +0 -28
  80. data/locales/pl.rb +0 -40
  81. data/locales/pt.rb +0 -29
  82. data/locales/ru.rb +0 -41
  83. data/locales/th.rb +0 -37
  84. data/locales/uk.rb +0 -27
  85. data/locales/vi.rb +0 -33
  86. data/r18n-core.gemspec +0 -29
  87. data/spec/filters_spec.rb +0 -324
  88. data/spec/i18n_spec.rb +0 -260
  89. data/spec/locale_spec.rb +0 -216
  90. data/spec/locales/cs_spec.rb +0 -23
  91. data/spec/locales/en-us_spec.rb +0 -13
  92. data/spec/locales/en_spec.rb +0 -13
  93. data/spec/locales/fa_spec.rb +0 -10
  94. data/spec/locales/fr_spec.rb +0 -9
  95. data/spec/locales/hu_spec.rb +0 -17
  96. data/spec/locales/it_spec.rb +0 -10
  97. data/spec/locales/no_spec.rb +0 -9
  98. data/spec/locales/pl_spec.rb +0 -23
  99. data/spec/locales/ru_spec.rb +0 -23
  100. data/spec/locales/sk_spec.rb +0 -23
  101. data/spec/locales/th_spec.rb +0 -9
  102. data/spec/locales/vi_spec.rb +0 -8
  103. data/spec/r18n_spec.rb +0 -172
  104. data/spec/spec_helper.rb +0 -41
  105. data/spec/translated_spec.rb +0 -163
  106. data/spec/translation_spec.rb +0 -164
  107. data/spec/translations/extension/deep/en.yml +0 -1
  108. data/spec/translations/extension/en.yml +0 -2
  109. data/spec/translations/extension/notransl.yml +0 -1
  110. data/spec/translations/general/en.yml +0 -47
  111. data/spec/translations/general/nolocale.yml +0 -6
  112. data/spec/translations/general/ru.yml +0 -7
  113. data/spec/translations/two/en.yml +0 -2
  114. data/spec/translations/two/fr.yml +0 -0
  115. data/spec/yaml_loader_spec.rb +0 -61
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01fc9db07f902211f29b89542f1b6aacb393c85efa4ef48e0750b24b9dbbc94e
4
- data.tar.gz: cf6c8d62cb4d1447bfd9b0f34fb78dde6e35ebe7ed71e3e7fb94132bb0593278
3
+ metadata.gz: ef8fd883bdb307b7895551a01d0d9abe1b8cf39d78f26d8d45289245b98d7cb4
4
+ data.tar.gz: 2964f46777aa5b30c6fcdb964acfb94c4d4c5e3d8c0a0ddfe878569487c84fa5
5
5
  SHA512:
6
- metadata.gz: de9b44856131d6d52daa7348033a6af6285bfe740f0a064ba24540071a2798a0d025976458112e6465d2386e2bfa61f5a11e40038dee4fcb77778a6103923ce0
7
- data.tar.gz: 7be0bf1ccf786dd09132779852cc86bcc4d5b620ce5de7d78640a04c87e33737a0a0cb98fc5e2b85faaa2e603d5592328446d8960ef32404332109561446614e
6
+ metadata.gz: 376737013d9e16b9873140a971df8456c76df92e60b69b610bd339a8c1e2df955dd412eee46a34e35b89e89508e6811bac6d252dcc85077972d0fa561bf97c5f
7
+ data.tar.gz: dc72f088623675f0dacdf2a8f6fd4987616605142b514b48ce2a00a2d29f2073230efb96b60bab30164175d30eef3d40ccc467fb1281d4f24a856f4dc5d16089
data/ChangeLog.md ADDED
@@ -0,0 +1,398 @@
1
+ # Change Log
2
+
3
+ ## Unreleased
4
+
5
+ ## 5.0.1 (2021-03-04)
6
+
7
+ ## 5.0.0 (Warszawa) (2021-03-04)
8
+
9
+ * Take out `r18n-core` gem from mono-repository.
10
+ * Set `I18n#locale` with region by its parent equal to received locale.
11
+ For example, if project has `en-US` and `de-DE` locales,
12
+ and `Accept-Language` HTTP header contains only `de` — set `de-DE` as locale.
13
+ * Add locales with regions as sublocales of each other.
14
+ And load them all, not only for the first! Recursively, I guess.
15
+ * Don't use `en` as default sublocale, it's strange.
16
+ * Remove block setters.
17
+ I don't know why (for what) they were here, they were introduced without any description.
18
+ I see no profit from such approach. Use regular `set` or justify the necessity, please.
19
+ * Rename `UnpluralizetedTranslation` to `UnpluralizedTranslation` (more correct spelling).
20
+ * Remake `i18n` and `now` arguments to keyword arguments for `localize` and `format_*` methods.
21
+ * Allow Hashes with blocks for `named_variables` filter.
22
+ It forces Symbol keys, but it does not break specs and it's more flexible.
23
+ * Fix custom `format_*` methods for classes with namespaces.
24
+ * Drop Ruby 2.4 support.
25
+ * Support Ruby 3.
26
+ * Avoid Ruby 4 in gem specs.
27
+ * Add metadata to gem specs.
28
+ * Add Alexander Popov as a gem author.
29
+ * Run specs in random order, fix phantom fails.
30
+ * Replace `rake` with `toys`.
31
+ * Add Codecov and SimpleCov.
32
+ * Update RuboCop, its configuration, and resolve new offenses.
33
+ * Fix many Ruby warnings.
34
+ * Add badges into README.
35
+
36
+ ## 4.0.0 (Santiago)
37
+
38
+ * Drop Ruby 2.3 support (by Alexander Popov).
39
+ * Drop `R18n::Utils.hash_map` (by Alexander Popov).
40
+ * Add Ruby 2.6 and 2.7 for CI (by Alexander Popov).
41
+ * Allow to add custom (per-project) locales (by Alexander Popov).
42
+ * Add block for `R18n.change` (change affects only code inside block)
43
+ (by Alexander Popov).
44
+ * Add `language` and `region` readers for `Locale` (by Alexander Popov).
45
+ * Allow upcased region in translation file names (like `en-US.yml`)
46
+ (by Alexander Popov).
47
+ * Load `base` translations from parent locale (by Alexander Popov).
48
+ * Downcase locales with regions for `Translated`, like `name_en_us`
49
+ instead of `name_en-US` (by Alexander Popov).
50
+ * Add Spanish Chile (`es-CL`) (by Juan Gil Miqueo).
51
+ * Add `:with_seconds` option for Time formatting (by Alexander Popov).
52
+ * Replace custom `gsub` in `R18n::Utils.escape_html` with `CGI.escapeHTML`
53
+ (by Alexander Popov).
54
+ * Improve Indonesian translation (by Mohammad Satrio).
55
+ * Improve documentation (by Alexander Popov).
56
+ * Fix issue with wildcard in `Accept-Language` header (by Alexander Popov).
57
+
58
+ ## 3.2.0 (Kawasaki)
59
+ * Support `*.yaml` files (by Alexander Popov).
60
+ * Locate processed `code` in `UnsupportedLocale`, like in `Locale` (by Alexander Popov).
61
+ * Fix `TranslatedString#to_ary`, don't return `Untranslated` (by Alexander Popov).
62
+ * Add Welsh language (`cy`) (by Mei Gwilym).
63
+ * Add support for custom classes localizing (`R18n.l`) (by Alexander Popov).
64
+ * Replace blank-padded day in date with no-padded (by Alexander Popov).
65
+ * Fix `TranslatedString#to_hash` (by Christian Höppner and Alexander Popov).
66
+
67
+ ## 3.1.2 (i)
68
+ * Call `Translation#itself` as translation key instead of `Kernel#itself` implementation (by Alexander Popov).
69
+
70
+ ## 3.1.1 (У)
71
+ * Fix errors and warnings from `gem build`
72
+
73
+ ## 3.1 (Одинцово)
74
+ * Move `named_variables` filter from `r18n-rails-api` to `r18n-core` (by Alexander Popov).
75
+ * Add possibility for `R18n::Locale` to define custom formatters (by Alexander Popov).
76
+ * Fix `R18n.set` for `r18n-desktop` (by Alexander Popov).
77
+
78
+ ## 3.0.5 (ب)
79
+ * Fix Farsi locale name (by @iriman).
80
+
81
+ ## 3.0.4 (𐤀)
82
+ * Fix `Translated` compatibility with `Hash` (by Alexander Popov).
83
+
84
+ ## 3.0.3 (〥)
85
+ * Fix missed filters in `Untranslted` initialization (by Alexander Popov).
86
+
87
+ ## 3.0.2 (Ё)
88
+ * Fix `Untranslted.to_s` (by Patrik Rak).
89
+
90
+ ## 3.0.1 (Brooklyn)
91
+ * Fix `no` locale deprecation warning.
92
+
93
+ ## 3.0 (New York)
94
+ * Deprecate `no` locale, use `nb` instead (by Alexander Popov).
95
+ * Remove unsafe `!!proc` filter.
96
+ * Reduce `eval` calls (by Alexander Popov).
97
+
98
+ ## 2.2 (La Habana)
99
+ * Change date format in `en` locale to `YYYY-MM-DD` (by Alexander Popov).
100
+ * Add `TranslatedString#as_json` for ActiveSupport compatibility (by Tim Craft).
101
+ * Fix `TranslatedString#html_safe?` behavior (by Tim Craft).
102
+ * Fix unsupported `LANG` environment (by Chris Poirier).
103
+ * Fix `Locale#localize` method for `DateTime` objects (by Alexander Popov).
104
+
105
+ ## 2.1.8 (Ѣ)
106
+ * Fix `true` and `false` keys support (by Alexander Popov).
107
+
108
+ ## 2.1.7 (Sewe)
109
+ * Add Afrikaans locale (by Llewellyn van der Merwe).
110
+
111
+ ## 2.1.6 (Berlin)
112
+ * Better `TranslatedString` → `String` converting (by Patrik Rak).
113
+ * Add Ruby on Rails 5 support.
114
+
115
+ ## 2.1.5 (මාතර)
116
+ * Fix Ruby 2.4 support (by Alexander Popov)
117
+
118
+ ## 2.1.4 (Bakı)
119
+ * Add Azerbaijani locale (by Adil Aliyev).
120
+
121
+ ## 2.1.3 (Seoul)
122
+ * Add Korean locale (by Patrick Cheng).
123
+
124
+ ## 2.1.2 (Wien)
125
+ * Fix Ruby 2.3 support.
126
+
127
+ ## 2.1.1 (Barcelona)
128
+ * Better sanity check for Accept-Language header (by Viktors Rotanovs).
129
+
130
+ ## 2.1 (Một)
131
+ * Add Vietnamese locale (by Nguyễn Văn Được).
132
+ * Add Persian locale.
133
+ * Allow to change date/time order in locales.
134
+ * Fix pluralization in locales without plural forms.
135
+ * Fix Mongolian base translations.
136
+
137
+ ## 2.0.4 (Ikkuna)
138
+ * Fix Windows support (by janahanEDH).
139
+
140
+ ## 2.0.3 (Hévíz)
141
+ * Fix Thai locale (by Kasima Tharnpipitchai).
142
+
143
+ ## 2.0.2 (Budapest)
144
+ * Fix array support in translations.
145
+ * Fix Rails support for dialect locales.
146
+
147
+ ## 2.0.1 (Amsterdam)
148
+ * Fix Dutch locale.
149
+
150
+ ## 2.0.0 (Москва)
151
+ * Remove Ruby 1.8 and 1.9 support.
152
+ * Add JRuby 9000 support.
153
+
154
+ ### 1.1.11 (São Paulo)
155
+ * Allow to set Proc as `default` option in Rails I18n back-end.
156
+
157
+ ### 1.1.10 (十)
158
+ * Fix Esperanto locale by Larry Gilbert.
159
+ * Fix Chinese locale (by 刘当一).
160
+
161
+ ### 1.1.9 (Не знайдено)
162
+ * Fix Rails 4.0.4 support. Prevent loop on `enforce_available_locales`.
163
+
164
+ ### 1.1.8 (Osam)
165
+ * Add Croatian locale (by Dino Kovač).
166
+ * Add Serbian latin locale (by Dino Kovač).
167
+
168
+ ### 1.1.7 (Tujuh)
169
+ * Return `nil` on untranslated in models with Translated.
170
+ * Add `transliterate` method to I18n back-end.
171
+ * Add Indonesian locale (by Guntur Akhmad).
172
+
173
+ ### 1.1.6 (Vitebsk)
174
+ * Return `TranslatedString` after global String filters.
175
+ * Fix path in global String filters.
176
+
177
+ ### 1.1.5 (Hilo)
178
+ * Fix Sinatra plugin under multi-threaded web-server (by Viktors Rotanovs).
179
+ * Fix `BigDecimal` localizing (by François Beausoleil).
180
+ * Add American American Spanish locale (by renemarcelo).
181
+
182
+ ### 1.1.4 (Bokmål)
183
+ * Add Norwegian `no` locale as gateway to Bokmål or Nynorsk.
184
+ * Fix Norwegian Bokmål locale code.
185
+ * Fix Hungarian time format (Kővágó Zoltán).
186
+
187
+ ### 1.1.3 (Saint Petersburg)
188
+ * Fix memory leak from cache key mismatch in Rails plugin (by silentshade).
189
+
190
+ ### 1.1.2 (Marshal)
191
+ * Fix translation and untranslated marshalizing (by silentshade).
192
+ * Allow to compare untranslated strings.
193
+ * Fix untranslated strings output in tests.
194
+
195
+ ### 1.1.1 (Dunhuang)
196
+ * Don't change YAML parser in Ruby 1.9.
197
+ * Allow to change locale by argument in R18n Rails back-end.
198
+ * Set also Rails I18n locale in Rails auto-detect filter.
199
+ * Fix caching with custom filters (by Anton Onyshchenko).
200
+ * Fix translation variables with `%1` text inside (by Taras Kunch).
201
+ * Fix Latvian locale (by Aleksandrs Ļedovskis).
202
+
203
+ ### 1.1.0 (Leipzig)
204
+ * A lot of fixes in Rails I18n compatibility (thanks for Stephan Schubert).
205
+ * Return `Untranslted`, when user try to call another translation key on
206
+ already translated string.
207
+ * Add `Translation#to_hash` to get raw translation.
208
+ * Add `Translation#inspect` to easy debug.
209
+ * Return translation, when pluralization filter did not get count.
210
+ * Set R18n back-end on Rails plugin init, to use it in console.
211
+ * Allow to use Integer in translation keys.
212
+
213
+ ### 1.0.1 (Phuket Town)
214
+ * Fix translation reloading in Rails and Sinatra.
215
+ * Use global R18n settings for Sinatra extension.
216
+ * Allow to override desktop auto-detect by LANG environment on all platforms.
217
+ * Add support for JRuby in 1.9 mode.
218
+ * Rename `R18n.reset` to `R18n.reset!` and add `R18n.clear_cache!`.
219
+ * Fix Sinatra with loaded ActiveSupport.
220
+ * Add Mongolian locale (by Elias Klughammer).
221
+
222
+ ### 1.0.0 (Bangkok)
223
+ * Add `R18n.default_places`.
224
+ * Rails `SafeBuffer` support.
225
+ * Allow in Rails app to put filters to `app/i18n` reload them in development.
226
+ * Move `R18n::I18n.available_locales` to `R18n.available_locales`.
227
+ * Rename `_keys` to `translation_keys`.
228
+ * Use Kramdown instead of Maruku for Markdown.
229
+ * Allow to use R18n for Rails without mailer.
230
+ * Allow to overwrite I18n object for models.
231
+ * Autoload R18n::Translated.
232
+ * Set default locale to R18n on Rails start to easy use in Rails console.
233
+ * Use env language in Rails console.
234
+ * Mark untranslated part as red in Rails console.
235
+ * Allow to temporary change locale by `R18n.change`.
236
+ * Add `R18n.locale` shortcut.
237
+ * Allow return from setter block locale code, instead of I18n object.
238
+ * Allow to set custom filters for I18n object.
239
+ * Add Galician locale (by Eduard Giménez).
240
+ * Add Traditional Chinese and Simplified Chinese (by Francis Chong).
241
+ * Fix Norsk locale (by Peter Haza).
242
+
243
+ ### 0.4.14 (üç)
244
+ * Fix support for Ruby 1.9.3.
245
+ * Added Turkish locale (by Ahmet Özkaya).
246
+ * Fix Swedish locale (by Pär Wieslander).
247
+
248
+ ### 0.4.13 (Sti)
249
+ * Fix `Pathname` to `String` error in `r18n-desktop`.
250
+ * Add Norwegian locale (by Oddmund Strømme).
251
+
252
+ ### 0.4.12 (Шлях)
253
+ * Fix `Pathname` to `String` conversion error.
254
+ * Fix model translation for non-ActiveRecord (by Szymon Przybył).
255
+ * Add Ukrainian locale (by Ярослав Руденок).
256
+
257
+ ### 0.4.11 (Nancy)
258
+ * Support for Sinatra 1.3.
259
+ * Fix JRuby support by Paul Walker.
260
+ * Add R18n helpers to Rails mailer by Alexey Medvedev.
261
+
262
+ ### 0.4.10 (Kvantum)
263
+ * Add R18n.set(locales, places), R18n.t and R18n.l shortcuts.
264
+ * Convert float to number on pluralization.
265
+ * Fix loading empty translation file.
266
+ * Add Portuguese locale.
267
+ * Add Dutch locale (by Sander Heilbron).
268
+ * Add Swedish locale (by Magnus Hörberg).
269
+
270
+ ### 0.4.9 (Kazan)
271
+ * Add support for Psych YAML parser (thanks for Ravil Bayramgalin).
272
+ * Fix ActiveRecord support in Translated.
273
+ * Fix Translated to return non-string values.
274
+ * Fix human time localization.
275
+ * Add Bulgarian locale (by Mitko Kostov).
276
+ * Add Australian English locale (by Dave Sag).
277
+
278
+ ### 0.4.8 (En ni to)
279
+ * Fix support for Ruby 1.9.2.
280
+ * Fix caching issue (by Viktors Rotanovs).
281
+ * Add Danish locale (by Hans Czajkowski Jørgensen)
282
+ * Fix Italian locale (by Viktors Rotanovs).
283
+ * Move untranslated filters with html highlight to `r18n-core`.
284
+
285
+ ### 0.4.7.1 (Kyū)
286
+ * Fix Japanese locale in Ruby 1.9.1.
287
+
288
+ ### 0.4.7 (Mado)
289
+ * Fix auto-detect locale in Windows and Ruby 1.9.1 (by Marvin Gülker).
290
+ * Fix auto-detect locale in JRuby (by Kővágó, Zoltán).
291
+ * Fix human time format on 60 minutes.
292
+ * Add Hungarian locale (by Kővágó, Zoltán).
293
+ * Add Japanese locale (by hryk).
294
+ * Fix Polish locale (by Piotr Szotkowski).
295
+
296
+ ### 0.4.6 (Trinity)
297
+ * Add support for new interpolation syntax in Rails 3.
298
+ * Add Catalian locale (by Jordi Romero).
299
+ * Add Finish locale (by Laura Guillén).
300
+ * Add British locale (by JP Hastings-Spital).
301
+ * Add Latvian locale (by Iļja Ketris).
302
+ * Fix Spanish (by Jordi Romero), German, French, Esperanto (by Iļja Ketris) and
303
+ Polish locales.
304
+ * Fix documentation (by Iļja Ketris and felix).
305
+ * Remove RubyGems from plugins requires.
306
+
307
+ ### 0.4.5 (Annual)
308
+ * Filters for several types.
309
+ * Global HTML escaping run before Markdown and Textile formatting.
310
+ * Fix active filters after passive filters.
311
+ * Fix human time formatting for dates with same month days.
312
+
313
+ ### 0.4.4 (Frank)
314
+ * Use before filter to lazy set I18n object in Sinatra extension.
315
+ * Set I18n object to thread (by Simon Hafner).
316
+ * Add to l Rails helper R18n syntax.
317
+ * Add common helpers.
318
+ * Clear cache in `R18n.reset`.
319
+ * Clean up code and fix bug (by Akzhan Abdulin).
320
+ * Add Thai locale (by Felix Hanley).
321
+
322
+ ### 0.4.3 (Flange)
323
+ * Add R18n style methods to Rails controllers.
324
+ * Fix for non-string translations in Rails I18n.
325
+ * Use default locale from Rails I18n config.
326
+ * Load translations recursively.
327
+ * Add Slovak locale (by Ahmed Al Hafoudh)
328
+
329
+ ### 0.4.2 (EMS)
330
+ * Fixes for Ruby 1.8.6 (by Akzhan Abdulin).
331
+ * Add method to get translation keys.
332
+
333
+ ### 0.4.1 (Lazy Boole)
334
+ * Add passive filters.
335
+ * Receive filter position as option `Hash`.
336
+ * Fix base translations (by Pavel Kunc).
337
+
338
+ ### 0.4 (D-Day)
339
+ * Rails I18n compatibility.
340
+ * Rewrite a lot of core code to fast and cleanup version.
341
+ * Custom translation loaders.
342
+ * Add reload! method to I18n.
343
+ * Add t and l helpers to Sinatra and desktop plugins.
344
+ * Syntax sugar for default values.
345
+ * Named variables.
346
+ * New locale API.
347
+ * Change API for extension translations.
348
+
349
+ ### 0.3.2 (Pidgin)
350
+ * Print path of untranslated string by filters.
351
+ * Add Italian locale (by Guido De Rosa).
352
+ * Fix Polish locale (by Adrian Pacała).
353
+ * Fix American English locale (by Max Aller).
354
+
355
+ ### 0.3.1 (Yield)
356
+ * Add Chinese locale (by Ilia Zayats).
357
+ * Add Spanish locale (by Andre O Moura).
358
+ * Add Brazilian Portuguese locale (by Andre O Moura).
359
+ * Remove RubyGems requires.
360
+
361
+ ### 0.3 (Vladivostok)
362
+ * `Translated` mixin to I18n support to model or any other class.
363
+ * New cool time formatters.
364
+ * Filters for translations.
365
+ * Add filters to escape HTML, Markdown and Textile syntax.
366
+ * Pluralization and variables is now filters and can be replaced.
367
+ * I18n#locales now contain all detected locales, used to load translations,
368
+ instead of just received from user.
369
+ * Bug-fix in locale code case.
370
+ * Add Czech locale (by Josef Pospíšil).
371
+
372
+ ### 0.2.3 (Shanghai eclipse)
373
+ * R18n will return path string if translation isn't exists.
374
+ * Add `UnsupportedLocale` class for locale without information file.
375
+ * Load absent locale information from default locale.
376
+ * Add Polish locale (by Tymon Tobolski).
377
+
378
+ ### 0.2.2 (Clone Wars)
379
+ * Localize numbers in pluralization.
380
+ * Bug-fix in translation variables.
381
+
382
+ ### 0.2.1 (Neun)
383
+ * Ruby 1.9 compatibility.
384
+ * Add German locale (by Benjamin Meichsner).
385
+
386
+ ### 0.2 (Freedom of Language)
387
+ * Locale class can be extended for special language (for example, Indian locale
388
+ may has another digits grouping).
389
+ * Load translations from several dirs.
390
+ * Add French locale.
391
+ * Add Kazakh locale.
392
+
393
+ ### 0.1.1 (Saluto)
394
+ * Loading I18n object without translations.
395
+ * Add output for standalone month name.
396
+ * Don't call procedures from translations if it isn't secure.
397
+ * Add Esperanto locale.
398
+ * English locale now contain UK date standards.
data/README.md CHANGED
@@ -1,25 +1,35 @@
1
- # R18n
1
+ # R18n Core
2
2
 
3
- R18n is an i18n tool to translate your Ruby application into several languages.
3
+ [![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/r18n/r18n-core?style=flat-square)](https://cirrus-ci.com/github/r18n/r18n-core)
4
+ [![Codecov branch](https://img.shields.io/codecov/c/github/r18n/r18n-core/master.svg?style=flat-square)](https://codecov.io/gh/r18n/r18n-core)
5
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/r18n/r18n-core.svg?style=flat-square)](https://codeclimate.com/github/r18n/r18n-core)
6
+ [![Depfu](https://img.shields.io/depfu/r18n/r18n-core?style=flat-square)](https://depfu.com/repos/github/r18n/r18n-core)
7
+ [![License](https://img.shields.io/github/license/r18n/r18n-core.svg?style=flat-square)](LICENSE)
8
+ [![Gem](https://img.shields.io/gem/v/r18n-core.svg?style=flat-square)](https://rubygems.org/gems/r18n-core)
4
9
 
5
- Use `r18n-rails` or `sinatra-r18n` to localize Web applications and
6
- `r18n-desktop` to localize desktop application.
10
+ [R18n](https://github.com/r18n/r18n) is an i18n tool to translate your Ruby application
11
+ into several languages.
12
+
13
+ You can use [wrapper plugins](https://github.com/r18n/r18n#wrapper-plugins)
14
+ like `r18n-rails` or `sinatra-r18n` to localize web applications
15
+ and `r18n-desktop` to localize desktop application.
7
16
 
8
17
  ## Features
9
18
 
10
19
  * Nice Ruby-style syntax.
11
20
  * Filters.
12
21
  * Model Translation (or any Ruby object).
13
- * Autodetect user locales.
22
+ * Auto-detect user locales.
14
23
  * Flexible locales.
15
24
  * Total flexibility.
16
25
 
17
- See full features in [main README](https://github.com/ai/r18n/blob/master/README.md).
26
+ See full features in [main README](https://github.com/r18n/r18n/blob/master/README.md).
18
27
 
19
28
  ## Usage
20
29
 
21
- To add i18n support to your app, you can use the particular plugin for your
22
- environment: `r18n-rails`, `sinatra-r18n` or `r18n-desktop`.
30
+ To add i18n support to your app, we suggest you to use
31
+ [the particular plugin](https://github.com/r18n/r18n#wrapper-plugins) for your environment,
32
+ for example `r18n-rails`, `sinatra-r18n` or `r18n-desktop`.
23
33
 
24
34
  If you develop you own plugin or want to use only core gem, you will need to
25
35
  set default translation places and current locale:
@@ -47,34 +57,35 @@ To set locale only for current thread use `R18n.thread_set`.
47
57
 
48
58
  Translation files are in YAML format by default and have names like
49
59
  `en.yml` (English) or `en-us.yml` (USA English dialect) with
50
- language/country code (RFC 3066).
60
+ language/country code (RFC 3066). Upcased region (`en-US`) and
61
+ `.yaml` file extension are also allowed.
51
62
 
52
63
  In your translation files you can use:
53
64
 
54
- * Strings
65
+ * Strings
55
66
 
56
67
  ```yaml
57
68
  robot: This is a robot
58
69
  percent: "Percent sign (%)"
59
70
  ```
60
71
 
61
- * Numbers
72
+ * Numbers
62
73
 
63
74
  ```yaml
64
75
  number: 123
65
76
  float: 12.45
66
77
  ```
67
78
 
68
- * Pluralizable messages
79
+ * Pluralizable messages
69
80
 
70
81
  ```yaml
71
82
  robots: !!pl
72
83
  0: No robots
73
84
  1: One robot
74
- n: %1 robots
85
+ n: '%1 robots'
75
86
  ```
76
87
 
77
- * Filters
88
+ * Filters
78
89
 
79
90
  ```yaml
80
91
  filtered: !!custom_type
@@ -96,7 +107,7 @@ t.post.add #=> "Add post"
96
107
  t[:post][:add] #=> "Add post"
97
108
  ```
98
109
 
99
- If the locale isnt found in the users requested locale, R18n will search for
110
+ If the locale isn't found in the user's requested locale, R18n will search for
100
111
  it in sublocales or in another locale, which the user also can accept:
101
112
 
102
113
  ```ruby
@@ -104,7 +115,7 @@ t.not.in.english #=> "В английском нет"
104
115
  ```
105
116
 
106
117
  The translated string has a `locale` method for determining its locale (Locale
107
- instance or code string if locale ist supported in R18n):
118
+ instance or code string if locale is't supported in R18n):
108
119
 
109
120
  ```ruby
110
121
  i18n.not.in.english.locale #=> Locale ru (Русский)
@@ -128,8 +139,8 @@ t.robots(1) #=> "One robot"
128
139
  t.robots(50) #=> "50 robots"
129
140
  ```
130
141
 
131
- If there isnt a pluralization for a particular number, translation will be use
132
- `n`. If there isnt a locale file for translation, it will use the English
142
+ If there isn't a pluralization for a particular number, translation will be use
143
+ `n`. If there isn't a locale file for translation, it will use the English
133
144
  pluralization rule (`0`, `1` and `n`).
134
145
 
135
146
  You can check if the key has a translation:
@@ -193,7 +204,7 @@ To create a filter you pass the following to `R18n::Filters.add`:
193
204
  * Optional filter name, to disable, enable or delete it later by
194
205
  `R18n::Filters.off`, `R18n::Filters.on` and
195
206
  `R18n::Filters.delete`.
196
- * Hash with options:
207
+ * `Hash` with options:
197
208
  * `passive: true` to filter translations only on load;
198
209
  * `:position` within the list of current filters of this type
199
210
  (by default a new filter will be inserted into last position).
@@ -201,7 +212,7 @@ To create a filter you pass the following to `R18n::Filters.add`:
201
212
  The filter will receive at least two arguments:
202
213
  * Translation (possibly already filtered by other filters for this type earlier
203
214
  in the list).
204
- * A Hash with translation `locale` and `path`.
215
+ * A `Hash` with translation `locale` and `path`.
205
216
  * Parameters from translation request will be in the remaining arguments.
206
217
 
207
218
  In Rails application put your filters to `app/i18n/filters.rb`, it will be
@@ -254,7 +265,7 @@ hi: !!markdown
254
265
  t.hi #=> "<p><strong>Hi</strong>, people!</p>"
255
266
  ```
256
267
 
257
- If you cant use Kramdown you can redefine Markdown filter
268
+ If you can't use Kramdown you can redefine Markdown filter
258
269
  to use your own parser:
259
270
 
260
271
  ```ruby
@@ -270,7 +281,7 @@ end
270
281
 
271
282
  #### Textile
272
283
 
273
- To use Textile in your translations you must install the RedCloth gem:
284
+ To use Textile in your translations you must install the `RedCloth` gem:
274
285
 
275
286
  ```yaml
276
287
  alarm: !!textile
@@ -311,8 +322,8 @@ l -12000.5 #=> "−12,000.5"
311
322
  Number and float formatters will also put real typographic minus and put
312
323
  non-breakable thin spaces (for locale, which use it as digit separator).
313
324
 
314
- You can translate months and week day names in Time, Date and DateTime by the
315
- `strftime` method:
325
+ You can translate months and week day names in `Time`, `Date` and `DateTime`
326
+ by the `strftime` method:
316
327
 
317
328
  ```ruby
318
329
  l Time.now, '%B' #=> "September"
@@ -330,8 +341,8 @@ l Time.now.to_date #=> "2009-08-09"
330
341
 
331
342
  ### Model
332
343
 
333
- You can add i18n support to any classes, including ORM models (ActiveRecord,
334
- DataMapper, MongoMapper, Mongoid or others):
344
+ You can add i18n support to any classes, including ORM models (`ActiveRecord`,
345
+ `Sequel`, `DataMapper`, `MongoMapper`, `Mongoid` or others):
335
346
 
336
347
  ```ruby
337
348
  class Product
@@ -361,9 +372,9 @@ See `R18n::Translated` for documentation.
361
372
 
362
373
  ### Locale
363
374
 
364
- All supported locales are stored in R18n gem in `locales` directory. If you want
365
- to add your locale, please fork this project and send a pull request or email me
366
- at <andrey@sitnik.ru>.
375
+ All supported locales are stored in `r18n-core` gem in `locales/` directory.
376
+ If you want to add your locale, please see the ["Add Locale"](#add-locale)
377
+ section.
367
378
 
368
379
  To get information about a locale create an `R18n::Locale` instance:
369
380
 
@@ -373,20 +384,20 @@ locale = R18n.locale('en')
373
384
 
374
385
  You can then get the following from the locale:
375
386
 
376
- * Locale title and RFC 3066 code:
387
+ * Locale title and RFC 3066 code:
377
388
 
378
389
  ```ruby
379
390
  locale.title #=> "English"
380
391
  locale.code #=> "en"
381
392
  ```
382
393
 
383
- * Language direction (left to right, or right to left for Arabic and Hebrew):
394
+ * Language direction (left to right, or right to left for Arabic and Hebrew):
384
395
 
385
396
  ```ruby
386
397
  locale.ltr? #=> true
387
398
  ```
388
399
 
389
- * Week start day (`:monday` or `:sunday`):
400
+ * Week start day (`:monday` or `:sunday`):
390
401
 
391
402
  ```ruby
392
403
  locale.week_start #=> :sunday
@@ -398,7 +409,7 @@ You can load translations from anywhere, not just from YAML files. To load
398
409
  translation you must create loader class with 2 methods:
399
410
 
400
411
  * `available` – return array of locales of available translations;
401
- * `load(locale)` – return Hash of translation.
412
+ * `load(locale)` – return `Hash` of translation.
402
413
 
403
414
  Pass its instance to `R18n.default_places` or `R18n.set(locales, loaders)`
404
415
 
@@ -448,32 +459,37 @@ R18n.extension_places << R18n::Loader::YAML.new('./error_messages/')
448
459
 
449
460
  ## Add Locale
450
461
 
451
- If R18n hasn’t got locale file for your language, please add it. Its very
462
+ If R18n has not got locale file for your language, please add it. It's very
452
463
  simple:
453
464
 
454
- * Create the file <tt><i>code</i>.rb</tt> in the `locales/` directory for your
455
- language and describe locale. Just copy from another locale and change the
465
+ * Create the file `%{code}.rb` for your language and describe locale, then
466
+ require it in the project. Just copy from another locale and change the
456
467
  values.
457
468
  * If your country has alternate languages (for example, in exUSSR countries
458
469
  most people also know Russian), add
459
- <tt>sublocales %w[<i>another_locale</i> en]</tt>.
460
- * Create in `base/` file <tt><i>code</i>.yml</tt> for your language and
461
- translate the base messages. Just copy file from language, which you know,
462
- and rewrite values.
470
+ `sublocales %w[%{another_locale} en]`.
463
471
  * If your language needs some special logic (for example, different
464
472
  pluralization or time formatters) you can extend `R18n::Locale` class methods.
465
- * Send a pull request via GitHub <http://github.com/ai/r18n> or just write email
466
- with the files to me <andrey@sitnik.ru>.
467
473
 
468
- *Code* is RFC 3066 code for your language (for example, “en” for English and
469
- “fr-CA” for Canadian French). Email me with any questions you may have, you will
470
- find other contact addresses at http://sitnik.ru.
474
+ If you want to send a pull request:
475
+
476
+ * Move your `%{code}.rb` file in the `locales/` directory.
477
+ * Create `%{code}.yml` file for your language in the `base/` directory and
478
+ translate the base messages. Just copy file from language, which you know,
479
+ and rewrite values.
480
+ * Send a pull request via GitHub <http://github.com/r18n/r18n> or just write
481
+ email with the files to [Andrey Sitnik](mailto:andrey@sitnik.ru)
482
+ or [Alexander Popov](mailto:alex.wayfer@gmail.com).
483
+
484
+ `%{code}` is RFC 3066 code for your language (for example, `en` for English and
485
+ `fr-CA` for Canadian French). Email me with any questions you may have, you will
486
+ find other contact addresses at [sitnik.ru](https://sitnik.ru/).
471
487
 
472
488
  ## License
473
489
 
474
490
  R18n is licensed under the GNU Lesser General Public License version 3.
475
- See the LICENSE file or http://www.gnu.org/licenses/lgpl.html.
491
+ See the LICENSE file or [www.gnu.org/licenses/lgpl-3.0.html](https://www.gnu.org/licenses/lgpl-3.0.html).
476
492
 
477
493
  ## Author
478
494
 
479
- Andrey “A.I.” Sitnik <andrey@sitnik.ru>
495
+ Andrey “A.I.” Sitnik [andrey@sitnik.ru](mailto:andrey@sitnik.ru)