gettext_simple_rails 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d00b567f8c0f4de3190531fe8432c568e5aa26b
4
- data.tar.gz: 415e870fcd1c235bf50e63cca42cbaa386ee0683
3
+ metadata.gz: a87f38683b4bbeb1223fc58afd9c567339cde259
4
+ data.tar.gz: b6be09ff859f2771112810d69c62c220bdb584c6
5
5
  SHA512:
6
- metadata.gz: be227b770df8458a6cda081c1f755c5e63fbf994d30a61535d83e7b702b668b9acbca46483379ea36307b76b191ae068c2171611ae16d942a3aaf2a3f3922707
7
- data.tar.gz: c268b48020bde34b23c0d6b147f53f372a61fd11f4e54a8ee918ebfb966703e7e2c57047d1a20c7541f6d4a195438c0db0597692074725f257d6ee5141057e25
6
+ metadata.gz: 6659037d43de6e7e6284a06ff49f95609ac098a3027fc5696b25311d5c6c835bf03c9bd4f54a734e58b11bf87a2fa03b94ffa9a65f47c22e2cd2537cb227f375
7
+ data.tar.gz: a0a4794a71e4641ef3438e368b0c33532e4a93b2f5716c574d8f0a43a548f0afb32ccca8d187ed35cb8e97738f8f6a07a2e9c211dc8f68c3fa23070eb870162b
@@ -9,6 +9,14 @@ class GettextSimpleRails::Translators::ActiveAdminTranslator
9
9
  "globalize" => {
10
10
  "language" => {},
11
11
  "translations" => ""
12
+ },
13
+ "devise" => {
14
+ "email" => {
15
+ "title" => "Email"
16
+ },
17
+ "password" => {
18
+ "title" => "Password"
19
+ }
12
20
  }
13
21
  }
14
22
  }
@@ -33,17 +33,11 @@ private
33
33
  attributes_hash[attribute_name] = {} unless attributes_hash.key?(attribute_name)
34
34
  attribute_hash = attributes_hash[attribute_name]
35
35
 
36
- if validator.is_a?(ActiveModel::Validations::LengthValidator)
37
- translations_for_length_validator(validator, attribute_hash)
38
- elsif validator.is_a?(ActiveModel::Validations::FormatValidator)
39
- translations_for_format_validator(validator, attribute_hash)
40
- elsif validator.is_a?(ActiveRecord::Validations::UniquenessValidator)
41
- translations_for_uniqueness_validator(validator, attribute_hash)
42
- elsif validator.is_a?(ActiveRecord::Validations::PresenceValidator)
43
- translations_for_presence_Validator(validator, attribute_hash)
44
- else
45
- puts "Unknown validator: #{validator.class.name}"
46
- end
36
+ translations_for_length_validator(validator, attribute_hash) if validator.is_a?(ActiveModel::Validations::LengthValidator)
37
+ translations_for_format_validator(validator, attribute_hash) if validator.is_a?(ActiveModel::Validations::FormatValidator)
38
+ translations_for_uniqueness_validator(validator, attribute_hash) if validator.is_a?(ActiveRecord::Validations::UniquenessValidator)
39
+ translations_for_presence_validator(validator, attribute_hash) if validator.is_a?(ActiveRecord::Validations::PresenceValidator)
40
+ translations_for_email_validator(validator, attribute_hash) if validator.class.name == "EmailValidator"
47
41
  end
48
42
  end
49
43
  end
@@ -71,7 +65,11 @@ private
71
65
  attribute_hash["taken"] = "has already been taken"
72
66
  end
73
67
 
74
- def translations_for_presence_Validator(validator, attribute_hash)
68
+ def translations_for_presence_validator(validator, attribute_hash)
75
69
  attribute_hash["blank"] = "cannot be blank"
76
70
  end
71
+
72
+ def translations_for_email_validator(validator, attribute_hash)
73
+ attribute_hash["invalid"] = "is invalid"
74
+ end
77
75
  end
@@ -1,3 +1,3 @@
1
1
  module GettextSimpleRails
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -24,5 +24,6 @@ describe GettextSimpleRails::Translators::ActiveRecordTranslator do
24
24
  cont.should include "_('activerecord.errors.models.user.attributes.name.blank')"
25
25
  cont.should include "_('activerecord.errors.models.user.attributes.name.taken')"
26
26
  cont.should include "_('activerecord.errors.models.user.attributes.name.invalid')"
27
+ cont.should include "_('activerecord.errors.models.user.attributes.email.invalid')"
27
28
  end
28
29
  end
@@ -1,7 +1,11 @@
1
+ require "email_validator"
2
+
1
3
  class User < ActiveRecord::Base
2
4
  has_many :roles
3
5
 
4
6
  validates :name, :length => {:in => 2..255}
5
7
  validates :name, :uniqueness => true, :presence => true
6
8
  validates :name, :format => {:with => /\A[A-z]+\Z/}
9
+
10
+ validates :email, :email => true
7
11
  end
@@ -12,5 +12,7 @@ class GettextSimpleRails::MonthNames
12
12
  _('activerecord.errors.models.user.attributes.name.blank')
13
13
  #. Default value: is invalid
14
14
  _('activerecord.errors.models.user.attributes.name.invalid')
15
+ #. Default value: is invalid
16
+ _('activerecord.errors.models.user.attributes.email.invalid')
15
17
  end
16
18
  end
@@ -330,3 +330,15 @@
330
330
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
331
331
   (0.1ms) begin transaction
332
332
   (0.1ms) rollback transaction
333
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
334
+  (0.1ms) begin transaction
335
+  (0.1ms) rollback transaction
336
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
337
+  (0.1ms) begin transaction
338
+  (0.1ms) rollback transaction
339
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
340
+  (0.1ms) begin transaction
341
+  (0.1ms) rollback transaction
342
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
343
+  (0.1ms) begin transaction
344
+  (0.1ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_simple_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: email_validator
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Inspects models and other modules to easily generate .po-files and translate
84
98
  them with POEdit.
85
99
  email: