active_storage_validations 1.0.4 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +126 -48
  3. data/config/locales/de.yml +6 -1
  4. data/config/locales/en.yml +5 -1
  5. data/config/locales/es.yml +6 -1
  6. data/config/locales/fr.yml +6 -1
  7. data/config/locales/it.yml +6 -1
  8. data/config/locales/ja.yml +6 -1
  9. data/config/locales/nl.yml +6 -1
  10. data/config/locales/pl.yml +6 -1
  11. data/config/locales/pt-BR.yml +6 -1
  12. data/config/locales/ru.yml +7 -2
  13. data/config/locales/sv.yml +23 -0
  14. data/config/locales/tr.yml +6 -1
  15. data/config/locales/uk.yml +6 -1
  16. data/config/locales/vi.yml +6 -1
  17. data/config/locales/zh-CN.yml +6 -1
  18. data/lib/active_storage_validations/aspect_ratio_validator.rb +57 -27
  19. data/lib/active_storage_validations/attached_validator.rb +20 -5
  20. data/lib/active_storage_validations/concerns/errorable.rb +38 -0
  21. data/lib/active_storage_validations/concerns/symbolizable.rb +12 -0
  22. data/lib/active_storage_validations/content_type_validator.rb +47 -7
  23. data/lib/active_storage_validations/dimension_validator.rb +61 -30
  24. data/lib/active_storage_validations/limit_validator.rb +49 -5
  25. data/lib/active_storage_validations/matchers/aspect_ratio_validator_matcher.rb +128 -0
  26. data/lib/active_storage_validations/matchers/attached_validator_matcher.rb +54 -23
  27. data/lib/active_storage_validations/matchers/concerns/active_storageable.rb +17 -0
  28. data/lib/active_storage_validations/matchers/concerns/allow_blankable.rb +26 -0
  29. data/lib/active_storage_validations/matchers/concerns/contextable.rb +35 -0
  30. data/lib/active_storage_validations/matchers/concerns/messageable.rb +26 -0
  31. data/lib/active_storage_validations/matchers/concerns/rspecable.rb +25 -0
  32. data/lib/active_storage_validations/matchers/concerns/validatable.rb +48 -0
  33. data/lib/active_storage_validations/matchers/content_type_validator_matcher.rb +75 -32
  34. data/lib/active_storage_validations/matchers/dimension_validator_matcher.rb +99 -52
  35. data/lib/active_storage_validations/matchers/size_validator_matcher.rb +96 -31
  36. data/lib/active_storage_validations/matchers.rb +1 -0
  37. data/lib/active_storage_validations/metadata.rb +42 -28
  38. data/lib/active_storage_validations/processable_image_validator.rb +16 -10
  39. data/lib/active_storage_validations/size_validator.rb +32 -9
  40. data/lib/active_storage_validations/version.rb +1 -1
  41. data/lib/active_storage_validations.rb +3 -0
  42. metadata +29 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe9e0494c1bf81d0f0a00c649abce9de1ff9c0dc8782a6a39253bdf1a890361d
4
- data.tar.gz: '0690ff0b6a259b35d074b8c81bad13ac4c699dbb1a3caca2b5b0b2b3d8b143ce'
3
+ metadata.gz: 305a698168303d4889b8ba6b3972201842af8679758f6f9c81140658a0abdc8a
4
+ data.tar.gz: 414b60017f2da20463daa783e56028c927c2090a80e7728877f569323ec0b60a
5
5
  SHA512:
6
- metadata.gz: 040ea6fc5660f163ba936b0b384eb515bad557f8d489bc75560e745b03011e97bc699c13e220f48f2e617b72abb70163f86cb7bdeb68522da48acb3508642679
7
- data.tar.gz: e014d61d14631626179784ce0f7e31a65264103264d0b39666c720e135e6b34b68a64f374157174a0f974644cfdb8b22deeeee365c2d29d6ccb7394e290edab0
6
+ metadata.gz: 48123a7a880a4f8e1b7680d3ea21b2e54c6f13b884b351e11c3f912fcdeec01efe24a0d6fc26b1021ec9b92460f6c6df321c869d9a8ce4e1848d339b1e35b0ca
7
+ data.tar.gz: faee600c94d2534a943feb4eebe14574341e3920e9bfd03fe663afad85c80e01c8cb7f95ced957ce333a323553798c6d73c0f8bffb33bdc185b922047f176b20
data/README.md CHANGED
@@ -68,15 +68,14 @@ end
68
68
 
69
69
  ### More examples
70
70
 
71
- - Content type validation using symbols. In order to infer the correct mime type from the symbol, the types must be registered with `Marcel::EXTENSIONS` (`MimeMagic::EXTENSIONS` for Rails <= 6.1.3).
71
+ - Content type validation using symbols or regex. The symbol types must be registered by [`Marcel::EXTENSIONS`](https://github.com/rails/marcel/blob/main/lib/marcel/tables.rb) that's used by this gem to infer the full content type.
72
72
 
73
73
  ```ruby
74
74
  class User < ApplicationRecord
75
75
  has_one_attached :avatar
76
76
  has_many_attached :photos
77
77
 
78
- validates :avatar, attached: true, content_type: :png # Marcel::Magic.by_extension(:png).to_s => 'image/png'
79
- # Rails <= 6.1.3; MimeMagic.by_extension(:png).to_s => 'image/png'
78
+ validates :avatar, attached: true, content_type: :png
80
79
  # or
81
80
  validates :photos, attached: true, content_type: [:png, :jpg, :jpeg]
82
81
  # or
@@ -149,7 +148,11 @@ en:
149
148
  errors:
150
149
  messages:
151
150
  content_type_invalid: "has an invalid content type"
152
- file_size_out_of_range: "size %{file_size} is not between required range"
151
+ file_size_not_less_than: "file size must be less than %{max_size} (current size is %{file_size})"
152
+ file_size_not_less_than_or_equal_to: "file size must be less than or equal to %{max_size} (current size is %{file_size})"
153
+ file_size_not_greater_than: "file size must be greater than %{min_size} (current size is %{file_size})"
154
+ file_size_not_greater_than_or_equal_to: "file size must be greater than or equal to %{min_size} (current size is %{file_size})"
155
+ file_size_not_between: "file size must be between %{min_size} and %{max_size} (current size is %{file_size})"
153
156
  limit_out_of_range: "total number is out of range"
154
157
  image_metadata_missing: "is not a valid image"
155
158
  dimension_min_inclusion: "must be greater than or equal to %{width} x %{height} pixel."
@@ -170,19 +173,63 @@ en:
170
173
  image_not_processable: "is not a valid image"
171
174
  ```
172
175
 
173
- In some cases, Active Storage Validations provides variables to help you customize messages:
176
+ In several cases, Active Storage Validations provides variables to help you customize messages:
174
177
 
175
- The "content_type_invalid" key has two variables that you can use, a variable named "content_type" containing the content type of the send file and a variable named "authorized_types" containing the list of authorized content types.
178
+ ### Aspect ratio
179
+ The keys starting with `aspect_ratio_` support two variables that you can use:
180
+ - `aspect_ratio` containing the expected aspect ratio, especially usefull for custom aspect ratio
181
+ - `filename` containing the current file name
176
182
 
177
- The variables are not used by default to leave the choice to the user.
183
+ For example :
184
+
185
+ ```yml
186
+ aspect_ratio_is_not: "must be a %{aspect_ratio} image"
187
+ ```
188
+
189
+ ### Content type
190
+ The `content_type_invalid` key has three variables that you can use:
191
+ - `content_type` containing the content type of the sent file
192
+ - `authorized_types` containing the list of authorized content types
193
+ - `filename` containing the current file name
194
+
195
+ For example :
196
+
197
+ ```yml
198
+ content_type_invalid: "has an invalid content type : %{content_type}, authorized types are %{authorized_types}"
199
+ ```
200
+
201
+ ### Dimension
202
+ The keys starting with `dimension_` support six variables that you can use:
203
+ - `min` containing the minimum width or height allowed
204
+ - `max` containing the maximum width or height allowed
205
+ - `width` containing the minimum or maximum width allowed
206
+ - `height` containing the minimum or maximum width allowed
207
+ - `lenght` containing the exact width or height allowed
208
+ - `filename` containing the current file name
209
+
210
+ For example :
211
+
212
+ ```yml
213
+ dimension_min_inclusion: "must be greater than or equal to %{width} x %{height} pixel."
214
+ ```
215
+
216
+ ### File size
217
+ The keys starting with `file_size_not_` support four variables that you can use:
218
+ - `file_size` containing the current file size
219
+ - `min` containing the minimum file size
220
+ - `max` containing the maxmimum file size
221
+ - `filename` containing the current file name
178
222
 
179
223
  For example :
180
224
 
181
225
  ```yml
182
- content_type_invalid: "has an invalid content type : %{content_type}"
226
+ file_size_not_between: "file size must be between %{min_size} and %{max_size} (current size is %{file_size})"
183
227
  ```
184
228
 
185
- Also the "limit_out_of_range" key supports two variables the "min" and "max".
229
+ ### Number of files
230
+ The `limit_out_of_range` key supports two variables that you can use:
231
+ - `min` containing the minimum number of files
232
+ - `max` containing the maximum number of files
186
233
 
187
234
  For example :
188
235
 
@@ -190,6 +237,16 @@ For example :
190
237
  limit_out_of_range: "total number is out of range. range: [%{min}, %{max}]"
191
238
  ```
192
239
 
240
+ ### Processable image
241
+ The `image_not_processable` key supports one variable that you can use:
242
+ - `filename` containing the current file name
243
+
244
+ For example :
245
+
246
+ ```yml
247
+ image_not_processable: "is not a valid image (file: %{filename})"
248
+ ```
249
+
193
250
  ## Installation
194
251
 
195
252
  Add this line to your application's Gemfile:
@@ -217,7 +274,7 @@ Very simple example of validation with file attached, content type check and cus
217
274
  [![Sample](https://raw.githubusercontent.com/igorkasyanchuk/active_storage_validations/master/docs/preview.png)](https://raw.githubusercontent.com/igorkasyanchuk/active_storage_validations/master/docs/preview.png)
218
275
 
219
276
  ## Test matchers
220
- Provides RSpec-compatible and Minitest-compatible matchers for testing the validators.
277
+ Provides RSpec-compatible and Minitest-compatible matchers for testing the validators. Only `aspect_ratio`, `attached`, `content_type`, `dimension` and `size` validators currently have their matcher developped.
221
278
 
222
279
  ### RSpec
223
280
 
@@ -235,25 +292,36 @@ RSpec.configure do |config|
235
292
  end
236
293
  ```
237
294
 
238
- Example (Note that the options are chainable):
295
+ Matcher methods available:
239
296
 
240
297
  ```ruby
241
298
  describe User do
299
+ # aspect_ratio:
300
+ # #allowing, #rejecting
301
+ it { is_expected.to validate_aspect_ratio_of(:avatar).allowing(:square) }
302
+ it { is_expected.to validate_aspect_ratio_of(:avatar).rejecting(:portrait) }
303
+
304
+ # attached
242
305
  it { is_expected.to validate_attached_of(:avatar) }
243
306
 
307
+ # content_type:
308
+ # #allowing, #rejecting
244
309
  it { is_expected.to validate_content_type_of(:avatar).allowing('image/png', 'image/gif') }
245
310
  it { is_expected.to validate_content_type_of(:avatar).rejecting('text/plain', 'text/xml') }
246
311
 
312
+ # dimension:
313
+ # #width, #height, #width_min, #height_min, #width_max, #height_max, #width_between, #height_between
247
314
  it { is_expected.to validate_dimensions_of(:avatar).width(250) }
248
315
  it { is_expected.to validate_dimensions_of(:avatar).height(200) }
249
- it { is_expected.to validate_dimensions_of(:avatar).width(250).height(200).with_message('Invalid dimensions.') }
250
316
  it { is_expected.to validate_dimensions_of(:avatar).width_min(200) }
251
- it { is_expected.to validate_dimensions_of(:avatar).width_max(500) }
252
317
  it { is_expected.to validate_dimensions_of(:avatar).height_min(100) }
318
+ it { is_expected.to validate_dimensions_of(:avatar).width_max(500) }
253
319
  it { is_expected.to validate_dimensions_of(:avatar).height_max(300) }
254
320
  it { is_expected.to validate_dimensions_of(:avatar).width_between(200..500) }
255
321
  it { is_expected.to validate_dimensions_of(:avatar).height_between(100..300) }
256
322
 
323
+ # size:
324
+ # #less_than, #less_than_or_equal_to, #greater_than, #greater_than_or_equal_to, #between
257
325
  it { is_expected.to validate_size_of(:avatar).less_than(50.kilobytes) }
258
326
  it { is_expected.to validate_size_of(:avatar).less_than_or_equal_to(50.kilobytes) }
259
327
  it { is_expected.to validate_size_of(:avatar).greater_than(1.kilobyte) }
@@ -261,9 +329,28 @@ describe User do
261
329
  it { is_expected.to validate_size_of(:avatar).between(100..500.kilobytes) }
262
330
  end
263
331
  ```
332
+ (Note that matcher methods are chainable)
333
+
334
+ All matchers can currently be customized with Rails validation options:
335
+
336
+ ```ruby
337
+ describe User do
338
+ # :allow_blank
339
+ it { is_expected.to validate_attached_of(:avatar).allow_blank }
340
+
341
+ # :on
342
+ it { is_expected.to validate_attached_of(:avatar).on(:update) }
343
+ it { is_expected.to validate_attached_of(:avatar).on(%i[update custom]) }
344
+
345
+ # :message
346
+ it { is_expected.to validate_dimensions_of(:avatar).width(250).with_message('Invalid dimensions.') }
347
+ end
348
+ ```
264
349
 
265
350
  ### Minitest
266
- To use the following syntax, make sure you have the [shoulda-context](https://github.com/thoughtbot/shoulda-context) gem up and running. To make use of the matchers you need to require the matchers:
351
+ To use the matchers, make sure you have the [shoulda-context](https://github.com/thoughtbot/shoulda-context) gem up and running.
352
+
353
+ You need to require the matchers:
267
354
 
268
355
  ```ruby
269
356
  require 'active_storage_validations/matchers'
@@ -277,62 +364,41 @@ class ActiveSupport::TestCase
277
364
  end
278
365
  ```
279
366
 
280
- Example (Note that the options are chainable):
281
-
282
- ```ruby
283
- class UserTest < ActiveSupport::TestCase
284
- should validate_attached_of(:avatar)
285
-
286
- should validate_content_type_of(:avatar).allowing('image/png', 'image/gif')
287
- should validate_content_type_of(:avatar).rejecting('text/plain', 'text/xml')
288
-
289
- should validate_dimensions_of(:avatar).width(250)
290
- should validate_dimensions_of(:avatar).height(200)
291
- should validate_dimensions_of(:avatar).width(250).height(200).with_message('Invalid dimensions.')
292
- should validate_dimensions_of(:avatar).width_min(200)
293
- should validate_dimensions_of(:avatar).width_max(500)
294
- should validate_dimensions_of(:avatar).height_min(100)
295
- should validate_dimensions_of(:avatar).height_max(300)
296
- should validate_dimensions_of(:avatar).width_between(200..500)
297
- should validate_dimensions_of(:avatar).height_between(100..300)
298
-
299
- should validate_size_of(:avatar).less_than(50.kilobytes)
300
- should validate_size_of(:avatar).less_than_or_equal_to(50.kilobytes)
301
- should validate_size_of(:avatar).greater_than(1.kilobyte)
302
- should validate_size_of(:avatar).greater_than_or_equal_to(1.kilobyte)
303
- should validate_size_of(:avatar).between(100..500.kilobytes)
304
- end
305
- ```
367
+ Then you can use the matchers with the syntax specified in the RSpec section, just use `should validate_method` instead of `it { is_expected_to validate_method }` as specified in the [shoulda-context](https://github.com/thoughtbot/shoulda-context) gem.
306
368
 
307
369
  ## Todo
308
370
 
309
371
  * verify with remote storages (s3, etc)
310
372
  * verify how it works with direct upload
311
- * better error message when content_size is invalid
312
373
  * add more translations
313
374
 
314
375
  ## Tests & Contributing
315
376
 
316
377
  To run tests in root folder of gem:
317
378
 
318
- * `BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake test` to run for Rails 6.0
319
- * `BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle exec rake test` to run for Rails 6.1
379
+ * `BUNDLE_GEMFILE=gemfiles/rails_6_1_3_1.gemfile bundle exec rake test` to run for Rails 6.1
320
380
  * `BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test` to run for Rails 7.0
381
+ * `BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec rake test` to run for Rails 7.0
321
382
  * `BUNDLE_GEMFILE=gemfiles/rails_next.gemfile bundle exec rake test` to run for Rails main branch
322
383
 
323
384
  Snippet to run in console:
324
385
 
325
- ```
326
- BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle
327
- BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle
386
+ ```bash
387
+ BUNDLE_GEMFILE=gemfiles/rails_6_1_3_1.gemfile bundle
328
388
  BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle
389
+ BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle
329
390
  BUNDLE_GEMFILE=gemfiles/rails_next.gemfile bundle
330
- BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake test
331
- BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle exec rake test
391
+ BUNDLE_GEMFILE=gemfiles/rails_6_1_3_1.gemfile bundle exec rake test
332
392
  BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test
393
+ BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile bundle exec rake test
333
394
  BUNDLE_GEMFILE=gemfiles/rails_next.gemfile bundle exec rake test
334
395
  ```
335
396
 
397
+ Tips:
398
+ - To focus a specific test, use the `focus` class method provided by [minitest-focus](https://github.com/minitest/minitest-focus)
399
+ - To focus a specific file, use the TEST option provided by minitest, e.g. to only run size_validator_test.rb file you will execute the following command: `bundle exec rake test TEST=test/validators/size_validator_test.rb`
400
+
401
+
336
402
  ## Known issues
337
403
 
338
404
  - There is an issue in Rails which it possible to get if you have added a validation and generating for example an image preview of attachments. It can be fixed with this:
@@ -346,8 +412,12 @@ BUNDLE_GEMFILE=gemfiles/rails_next.gemfile bundle exec rake test
346
412
  This is a Rails issue, and is fixed in Rails 6.
347
413
 
348
414
  ## Contributing
415
+
349
416
  You are welcome to contribute.
350
417
 
418
+ [<img src="https://opensource-heroes.com/svg/embed/igorkasyanchuk/active_storage_validations"
419
+ />](https://opensource-heroes.com/r/igorkasyanchuk/active_storage_validations)
420
+
351
421
  ## Contributors (BIG THANK YOU)
352
422
  - https://github.com/schweigert
353
423
  - https://github.com/tleneveu
@@ -403,6 +473,14 @@ You are welcome to contribute.
403
473
  - https://github.com/sobrinho
404
474
  - https://github.com/iainbeeston
405
475
  - https://github.com/marckohlbrugge
476
+ - https://github.com/Mth0158
477
+ - https://github.com/technicalpickles
478
+ - https://github.com/ricsdeol
479
+ - https://github.com/Fonsan
480
+ - https://github.com/tagliala
481
+ - https://github.com/ocarreterom
482
+ - https://github.com/aditya-cherukuri
483
+
406
484
 
407
485
  ## License
408
486
 
@@ -2,7 +2,11 @@ de:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "hat einen ungültigen Dateityp"
5
- file_size_out_of_range: "Dateigröße %{file_size} liegt nicht im erlaubten Bereich"
5
+ file_size_not_less_than: "Dateigröße muss kleiner als %{max_size} sein (aktuelle Dateigröße ist %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "Dateigröße muss kleiner oder gleich %{max_size} sein (aktuelle Dateigröße ist %{file_size})"
7
+ file_size_not_greater_than: "Dateigröße muss größer als %{min_size} sein (aktuelle Dateigröße ist %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "Dateigröße muss größer oder gleich %{min_size} sein (aktuelle Dateigröße ist %{file_size})"
9
+ file_size_not_between: "Dateigröße muss zwischen %{min_size} und %{max_size} liegen (aktuelle Dateigröße ist %{file_size})"
6
10
  limit_out_of_range: "Anzahl ist außerhalb des gültigen Bereichs"
7
11
  image_metadata_missing: "ist kein gültiges Bild"
8
12
  dimension_min_inclusion: "muss größer oder gleich %{width} x %{height} Pixel sein"
@@ -20,3 +24,4 @@ de:
20
24
  aspect_ratio_not_landscape: "muss Querformat sein"
21
25
  aspect_ratio_is_not: "muss ein Bildseitenverhältnis von %{aspect_ratio} haben"
22
26
  aspect_ratio_unknown: "hat ein unbekanntes Bildseitenverhältnis"
27
+ image_not_processable: "ist kein gültiges Bild"
@@ -2,7 +2,11 @@ en:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "has an invalid content type"
5
- file_size_out_of_range: "size %{file_size} is not between required range"
5
+ file_size_not_less_than: "file size must be less than %{max_size} (current size is %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "file size must be less than or equal to %{max_size} (current size is %{file_size})"
7
+ file_size_not_greater_than: "file size must be greater than %{min_size} (current size is %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "file size must be greater than or equal to %{min_size} (current size is %{file_size})"
9
+ file_size_not_between: "file size must be between %{min_size} and %{max_size} (current size is %{file_size})"
6
10
  limit_out_of_range: "total number is out of range"
7
11
  image_metadata_missing: "is not a valid image"
8
12
  dimension_min_inclusion: "must be greater than or equal to %{width} x %{height} pixel"
@@ -2,7 +2,11 @@ es:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "tiene un tipo de contenido inválido"
5
- file_size_out_of_range: "tamaño %{file_size} no está entre el rango requerido"
5
+ file_size_not_less_than: "el tamaño del archivo debe ser inferior a %{max_size} (el tamaño actual es %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "el tamaño del archivo debe ser menor o igual a %{max_size} (el tamaño actual es %{file_size})"
7
+ file_size_not_greater_than: "el tamaño del archivo debe ser mayor que %{min_size} (el tamaño actual es %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "el tamaño del archivo debe ser mayor o igual a %{min_size} (el tamaño actual es %{file_size})"
9
+ file_size_not_between: "el tamaño del archivo debe estar entre %{min_size} y %{max_size} (el tamaño actual es %{file_size})"
6
10
  limit_out_of_range: "el número total está fuera de rango"
7
11
  image_metadata_missing: "no es una imagen válida"
8
12
  dimension_min_inclusion: "debe ser mayor o igual a %{width} x %{height} pixel"
@@ -20,3 +24,4 @@ es:
20
24
  aspect_ratio_not_landscape: "debe ser una imagen apaisada"
21
25
  aspect_ratio_is_not: "debe tener una relación de aspecto de %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "tiene una relación de aspecto desconocida"
27
+ image_not_processable: "no es una imagen válida"
@@ -2,7 +2,11 @@ fr:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "a un type de contenu non valide"
5
- file_size_out_of_range: "la taille %{file_size} n'est pas comprise dans la plage permise"
5
+ file_size_not_less_than: "la taille du fichier doit être inférieure à %{max_size} (la taille actuelle est %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "la taille du fichier doit être inférieure ou égale à %{max_size} (la taille actuelle est %{file_size})"
7
+ file_size_not_greater_than: "la taille du fichier doit être supérieure à %{min_size} (la taille actuelle est %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "la taille du fichier doit être supérieure ou égale à %{min_size} (la taille actuelle est %{file_size})"
9
+ file_size_not_between: "la taille du fichier doit être comprise entre %{min_size} et %{max_size} (la taille actuelle est %{file_size})"
6
10
  limit_out_of_range: "le nombre total est hors limites"
7
11
  image_metadata_missing: "n'est pas une image valide"
8
12
  dimension_min_inclusion: "doit être supérieur ou égal à %{width} x %{height} pixels"
@@ -20,3 +24,4 @@ fr:
20
24
  aspect_ratio_not_landscape: "doit être une image en format paysage"
21
25
  aspect_ratio_is_not: "doit avoir un rapport hauteur / largeur de %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "a un rapport d'aspect inconnu"
27
+ image_not_processable: "n'est pas une image valide"
@@ -2,7 +2,11 @@ it:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "ha un tipo di contenuto non valido"
5
- file_size_out_of_range: "la dimensione del file %{file_size} non è compresa nell’intervallo consentito"
5
+ file_size_not_less_than: "la dimensione del file deve essere inferiore a %{max_size} (la dimensione attuale è %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "la dimensione del file deve essere minore o uguale a %{max_size} (la dimensione attuale è %{file_size})"
7
+ file_size_not_greater_than: "la dimensione del file deve essere maggiore di %{min_size} (la dimensione attuale è %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "la dimensione del file deve essere maggiore o uguale a %{min_size} (la dimensione attuale è %{file_size})"
9
+ file_size_not_between: "la dimensione del file deve essere compresa tra %{min_size} e %{max_size} (la dimensione attuale è %{file_size})"
6
10
  limit_out_of_range: "il valore è al di fuori dell’intervallo consentito"
7
11
  image_metadata_missing: "non è un'immagine valida"
8
12
  dimension_min_inclusion: "deve essere maggiore o uguale a %{width} x %{height} pixel"
@@ -20,3 +24,4 @@ it:
20
24
  aspect_ratio_not_landscape: "l’orientamento dell’immagine deve essere orizzontale"
21
25
  aspect_ratio_is_not: "deve avere un rapporto altezza / larghezza di %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "ha un rapporto altezza / larghezza sconosciuto"
27
+ image_not_processable: "non è un'immagine valida"
@@ -2,7 +2,11 @@ ja:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "のContent Typeが不正です"
5
- file_size_out_of_range: "の容量 %{file_size} が許容範囲外です"
5
+ file_size_not_less_than: "ファイル サイズは %{max_size} 未満にする必要があります (現在のサイズは %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "ファイル サイズは %{max_size} 以下である必要があります (現在のサイズは %{file_size})"
7
+ file_size_not_greater_than: "ファイル サイズは %{min_size} より大きい必要があります (現在のサイズは %{file_size} です)"
8
+ file_size_not_greater_than_or_equal_to: "ファイル サイズは %{min_size} 以上である必要があります (現在のサイズは %{file_size})"
9
+ file_size_not_between: "ファイル サイズは %{min_size} から %{max_size} の間でなければなりません (現在のサイズは %{file_size} です)"
6
10
  limit_out_of_range: "の数が許容範囲外です"
7
11
  image_metadata_missing: "は不正な画像です"
8
12
  dimension_min_inclusion: "は %{width} x %{height} ピクセル以上の大きさにしてください"
@@ -20,3 +24,4 @@ ja:
20
24
  aspect_ratio_not_landscape: "は横長にしてください"
21
25
  aspect_ratio_is_not: "のアスペクト比は %{aspect_ratio} にしてください"
22
26
  aspect_ratio_unknown: "のアスペクト比を取得できませんでした"
27
+ image_not_processable: "は不正な画像です"
@@ -2,7 +2,11 @@ nl:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "heeft een ongeldig inhoudstype"
5
- file_size_out_of_range: "bestandsgrootte %{file_size} valt niet tussen het vereiste bereik"
5
+ file_size_not_less_than: "bestandsgrootte moet kleiner zijn dan %{max_size} (huidige grootte is %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "bestandsgrootte moet kleiner zijn dan of gelijk zijn aan %{max_size} (huidige grootte is %{file_size})"
7
+ file_size_not_greater_than: "bestandsgrootte moet groter zijn dan %{min_size} (huidige grootte is %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "bestandsgrootte moet groter zijn dan of gelijk zijn aan %{min_size} (huidige grootte is %{file_size})"
9
+ file_size_not_between: "bestandsgrootte moet tussen %{min_size} en %{max_size} liggen (huidige grootte is %{file_size})"
6
10
  limit_out_of_range: "totaal aantal valt buiten het vereiste bereik"
7
11
  image_metadata_missing: "is geen geldige afbeelding"
8
12
  dimension_min_inclusion: "moet groter of gelijk zijn aan %{width} x %{height} pixels"
@@ -20,3 +24,4 @@ nl:
20
24
  aspect_ratio_not_landscape: "moet een liggende afbeelding zijn"
21
25
  aspect_ratio_is_not: "moet een beeldverhouding hebben van %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "heeft een onbekende beeldverhouding"
27
+ image_not_processable: "is geen geldige afbeelding"
@@ -2,7 +2,11 @@ pl:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "jest nieprawidłowego typu"
5
- file_size_out_of_range: "rozmiar %{file_size} nie zawiera się w dopuszczalnym zakresie"
5
+ file_size_not_less_than: "rozmiar pliku musi być mniejszy niż %{max_size} (obecny rozmiar to %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "rozmiar pliku musi być mniejszy lub równy %{max_size} (obecny rozmiar to %{file_size})"
7
+ file_size_not_greater_than: "rozmiar pliku musi być większy niż %{min_size} (obecny rozmiar to %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "rozmiar pliku musi być większy lub równy %{min_size} (obecny rozmiar to %{file_size})"
9
+ file_size_not_between: "rozmiar pliku musi mieścić się w przedziale od %{min_size} do %{max_size} (obecny rozmiar to %{file_size})"
6
10
  limit_out_of_range: "ilość przekracza dopuszczalny zakres"
7
11
  image_metadata_missing: "nie jest prawidłowym obrazem"
8
12
  dimension_min_inclusion: "musi być równe lub większe od %{width} x %{height} pixeli"
@@ -20,3 +24,4 @@ pl:
20
24
  aspect_ratio_not_landscape: "musi mieć proporcje pejzażu"
21
25
  aspect_ratio_is_not: "musi mieć proporcje %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "ma nieokreślone proporcje"
27
+ image_not_processable: "nie jest prawidłowym obrazem"
@@ -2,7 +2,11 @@ pt-BR:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "tem um tipo de arquivo inválido"
5
- file_size_out_of_range: "tem tamanho %{file_size} e está fora da faixa de tamanho válida"
5
+ file_size_not_less_than: "o tamanho do arquivo deve ser menor que %{max_size} (o tamanho atual é %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "o tamanho do arquivo deve ser menor ou igual a %{max_size} (o tamanho atual é %{file_size})"
7
+ file_size_not_greater_than: "o tamanho do arquivo deve ser maior que %{min_size} (o tamanho atual é %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "o tamanho do arquivo deve ser maior ou igual a %{min_size} (o tamanho atual é %{file_size})"
9
+ file_size_not_between: "o tamanho do arquivo deve estar entre %{min_size} e %{max_size} (o tamanho atual é %{file_size})"
6
10
  limit_out_of_range: "o número total está fora do limite"
7
11
  image_metadata_missing: "não é uma imagem válida"
8
12
  dimension_min_inclusion: "deve ser maior ou igual a %{width} x %{height} pixels"
@@ -20,3 +24,4 @@ pt-BR:
20
24
  aspect_ratio_not_landscape: "não está no formato paisagem"
21
25
  aspect_ratio_is_not: "não contém uma proporção de %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "não tem uma proporção definida"
27
+ image_not_processable: "não é uma imagem válida"
@@ -2,7 +2,11 @@ ru:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "имеет недопустимый тип содержимого"
5
- file_size_out_of_range: "размер %{file_size} больше требуемого"
5
+ file_size_not_less_than: "размер файла должен быть меньше %{max_size} (текущий размер %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "размер файла должен быть меньше или равен %{max_size} (текущий размер %{file_size})"
7
+ file_size_not_greater_than: "размер файла должен быть больше %{min_size} (текущий размер %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "размер файла должен быть больше или равен %{min_size} (текущий размер %{file_size})"
9
+ file_size_not_between: "размер файла должен быть между %{min_size} и %{max_size} (текущий размер %{file_size})"
6
10
  limit_out_of_range: "количество файлов больше требуемого"
7
11
  image_metadata_missing: "не является допустимым изображением"
8
12
  dimension_min_inclusion: "должен быть больше или равно %{width} x %{height} пикселям"
@@ -19,4 +23,5 @@ ru:
19
23
  aspect_ratio_not_portrait: "должно быть портретное изображение"
20
24
  aspect_ratio_not_landscape: "должно быть пейзажное изображение"
21
25
  aspect_ratio_is_not: "должен иметь соотношение сторон %{aspect_ratio}"
22
- aspect_ratio_unknown: "имеет неизвестное соотношение сторон"
26
+ aspect_ratio_unknown: "имеет неизвестное соотношение сторон"
27
+ image_not_processable: "не является допустимым изображением"
@@ -0,0 +1,23 @@
1
+ sv:
2
+ errors:
3
+ messages:
4
+ content_type_invalid: "Har en ogiltig filtyp"
5
+ file_size_out_of_range: "storleken %{file_size} är utanför det krävda intervallet"
6
+ limit_out_of_range: "antalet filer är utanför det godkända intervallet"
7
+ image_metadata_missing: "bilden sankar metadata"
8
+ dimension_min_inclusion: "måste minst vara %{width} x %{height} pixlar"
9
+ dimension_max_inclusion: "måste vara mindre eller lika med %{width} x %{height} pixlar"
10
+ dimension_width_inclusion: "bredden är utanför %{min} till %{max} pixlar"
11
+ dimension_height_inclusion: "höjden är utanför %{min} till %{max} pixlar"
12
+ dimension_width_greater_than_or_equal_to: "bredden måste minst vara %{length} pixlar"
13
+ dimension_height_greater_than_or_equal_to: "höjden måste minst vara %{length} pixlar"
14
+ dimension_width_less_than_or_equal_to: "bredden får max vara %{length} pixlar"
15
+ dimension_height_less_than_or_equal_to: "höjden får max vara %{length} pixlar"
16
+ dimension_width_equal_to: "bredden måste vara %{length} pixlar"
17
+ dimension_height_equal_to: "höjden måste vara %{length} pixlar"
18
+ aspect_ratio_not_square: "måste vara en kvadratisk bild"
19
+ aspect_ratio_not_portrait: "måste vara en porträttorienterad bild"
20
+ aspect_ratio_not_landscape: "måste vara en landskapsorienterad bild"
21
+ aspect_ratio_is_not: "måste ha en följande aspect ratio %{aspect_ratio}"
22
+ aspect_ratio_unknown: "har en okänd aspect ratio"
23
+ image_not_processable: "är inte en giltig bild"
@@ -2,7 +2,11 @@ tr:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "geçersiz dosya tipine sahip"
5
- file_size_out_of_range: "dosya boyutu %{file_size} gerekli aralık dışında"
5
+ file_size_not_less_than: "dosya boyutu %{max_size} boyutundan küçük olmalıdır (geçerli boyut %{file_size}'dir)"
6
+ file_size_not_less_than_or_equal_to: "dosya boyutu %{max_size} değerinden küçük veya ona eşit olmalıdır (geçerli boyut %{file_size}'dir)"
7
+ file_size_not_greater_than: "dosya boyutu %{min_size} boyutundan büyük olmalıdır (geçerli boyut %{file_size}'dir)"
8
+ file_size_not_greater_than_or_equal_to: "dosya boyutu %{min_size} değerinden büyük veya eşit olmalıdır (geçerli boyut %{file_size}'dir)"
9
+ file_size_not_between: "dosya boyutu %{min_size} ile %{max_size} arasında olmalıdır (geçerli boyut %{file_size}'dir)"
6
10
  limit_out_of_range: "toplam miktar aralık dışında"
7
11
  image_metadata_missing: "geçerli bir imaj değil"
8
12
  dimension_min_inclusion: "%{width} x %{height} piksele eşit ya da büyük olmalı"
@@ -20,3 +24,4 @@ tr:
20
24
  aspect_ratio_not_landscape: "yatay bir imaj olmalı"
21
25
  aspect_ratio_is_not: "%{aspect_ratio} en boy oranına sahip olmalı"
22
26
  aspect_ratio_unknown: "bilinmeyen en boy oranı"
27
+ image_not_processable: "geçerli bir imaj değil"
@@ -2,7 +2,11 @@ uk:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "має неприпустимий тип вмісту"
5
- file_size_out_of_range: "розмір %{file_size} більше необхідного"
5
+ file_size_not_less_than: "розмір файлу має бути менше %{max_size} (поточний розмір %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "розмір файлу має бути меншим або дорівнювати %{max_size} (поточний розмір %{file_size})"
7
+ file_size_not_greater_than: "розмір файлу має бути більшим ніж %{min_size} (поточний розмір %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "розмір файлу має бути більшим або дорівнювати %{min_size} (поточний розмір %{file_size})"
9
+ file_size_not_between: "розмір файлу має бути від %{min_size} до %{max_size} (поточний розмір %{file_size})"
6
10
  limit_out_of_range: "кількість файлів більше необхідного"
7
11
  image_metadata_missing: "не є допустимим зображенням"
8
12
  dimension_min_inclusion: "мусить бути більше або дорівнювати %{width} x %{height} пікселям"
@@ -20,3 +24,4 @@ uk:
20
24
  aspect_ratio_not_landscape: "мусить бути пейзажне зображення"
21
25
  aspect_ratio_is_not: "мусить мати співвідношення сторін %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "має невідоме співвідношення сторін"
27
+ image_not_processable: "не є допустимим зображенням"
@@ -2,7 +2,11 @@ vi:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "tệp không hợp lệ"
5
- file_size_out_of_range: "kích thước %{file_size} vượt giới hạn"
5
+ file_size_not_less_than: "kích thước tệp phải nhỏ hơn %{max_size} (kích thước hiện tại là %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "kích thước tệp phải nhỏ hơn hoặc bằng %{max_size} (kích thước hiện tại là %{file_size})"
7
+ file_size_not_greater_than: "kích thước tệp phải lớn hơn %{min_size} (kích thước hiện tại là %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "kích thước tệp phải lớn hơn hoặc bằng %{min_size} (kích thước hiện tại là %{file_size})"
9
+ file_size_not_between: "kích thước tệp phải nằm trong khoảng từ %{min_size} đến %{max_size} (kích thước hiện tại là %{file_size})"
6
10
  limit_out_of_range: "tổng số tệp vượt giới hạn"
7
11
  image_metadata_missing: "không phải là ảnh"
8
12
  dimension_min_inclusion: "phải lớn hơn hoặc bằng %{width} x %{height} pixel"
@@ -20,3 +24,4 @@ vi:
20
24
  aspect_ratio_not_landscape: "phải là ảnh ngang"
21
25
  aspect_ratio_is_not: "phải có tỉ lệ ảnh %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "tỉ lệ ảnh không xác định"
27
+ image_not_processable: "không phải là ảnh"
@@ -2,7 +2,11 @@ zh-CN:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid: "文件类型错误"
5
- file_size_out_of_range: "文件大小 %{file_size} 超出限定范围"
5
+ file_size_not_less_than: "文件大小必须小于 %{max_size}(当前大小为 %{file_size})"
6
+ file_size_not_less_than_or_equal_to: "文件大小必须小于或等于 %{max_size}(当前大小为 %{file_size})"
7
+ file_size_not_greater_than: "文件大小必须大于 %{min_size}(当前大小为 %{file_size})"
8
+ file_size_not_greater_than_or_equal_to: "文件大小必须大于或等于 %{min_size}(当前大小为 %{file_size})"
9
+ file_size_not_between: "文件大小必须介于 %{min_size} 和 %{max_size} 之间(当前大小为 %{file_size})"
6
10
  limit_out_of_range: "文件数超出限定范围"
7
11
  image_metadata_missing: "不是有效的图像"
8
12
  dimension_min_inclusion: "必须大于或等于 %{width} x %{height} 像素"
@@ -20,3 +24,4 @@ zh-CN:
20
24
  aspect_ratio_not_landscape: "必须是横屏图片"
21
25
  aspect_ratio_is_not: "纵横比必须是 %{aspect_ratio}"
22
26
  aspect_ratio_unknown: "未知的纵横比"
27
+ image_not_processable: "不是有效的图像"