i18n_screwdriver 9.2 → 9.3

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: dbe8ce60e602808de3bed486e4996074699f1081
4
- data.tar.gz: 0166cae973e6c9729c45d92e8c1ded33a3bd61be
3
+ metadata.gz: 494976232d84a1a9b9e5e5f5375ccd27b10d5c91
4
+ data.tar.gz: 9ec2f827751a5874ba7abced143d3294c6aa8c9e
5
5
  SHA512:
6
- metadata.gz: 85676b094e7a2cae208da19d6cea5ede7ade91f3700c0de117aaa25c2d3443414a1f5a463483d81af00beff8a9e4a7b4e04e4a15a2cda00fe2a45b43e7b53a49
7
- data.tar.gz: 3a8306d4671148b31eb6d1002bdf9591bddea00fa8a71b407b43e316d52b513afce18f07b5a6c392ca8f7d3948c62b9c9782bba8c0ed71890f563b53bcac8915
6
+ metadata.gz: 89755396a9bed8a473915f250f0f40af1566a6a0dc895bb0b76e31875ecffdc3ba1a2f1201002ee55310e0cb7b25baf90515dd9dc375a02da3029f3f6468b45c
7
+ data.tar.gz: fecced1456e6fabdffe71161ade76c9ed11d226da61e5f5cbf0ca4e6edd6f4ed28a1e8508874c651dd5938e3ef08e2a6bc07e9fc832488b4ac56436a739a711e
data/.gitignore CHANGED
@@ -2,3 +2,7 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+
6
+ .idea
7
+
8
+ .byebug_history
data/Gemfile.lock CHANGED
@@ -1,93 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- i18n_screwdriver (9.0)
4
+ i18n_screwdriver (9.3)
5
5
  rails (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (4.2.5.1)
11
- actionpack (= 4.2.5.1)
12
- actionview (= 4.2.5.1)
13
- activejob (= 4.2.5.1)
10
+ actioncable (5.0.2)
11
+ actionpack (= 5.0.2)
12
+ nio4r (>= 1.2, < 3.0)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.0.2)
15
+ actionpack (= 5.0.2)
16
+ actionview (= 5.0.2)
17
+ activejob (= 5.0.2)
14
18
  mail (~> 2.5, >= 2.5.4)
15
- rails-dom-testing (~> 1.0, >= 1.0.5)
16
- actionpack (4.2.5.1)
17
- actionview (= 4.2.5.1)
18
- activesupport (= 4.2.5.1)
19
- rack (~> 1.6)
20
- rack-test (~> 0.6.2)
21
- rails-dom-testing (~> 1.0, >= 1.0.5)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.0.2)
21
+ actionview (= 5.0.2)
22
+ activesupport (= 5.0.2)
23
+ rack (~> 2.0)
24
+ rack-test (~> 0.6.3)
25
+ rails-dom-testing (~> 2.0)
22
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
- actionview (4.2.5.1)
24
- activesupport (= 4.2.5.1)
27
+ actionview (5.0.2)
28
+ activesupport (= 5.0.2)
25
29
  builder (~> 3.1)
26
30
  erubis (~> 2.7.0)
27
- rails-dom-testing (~> 1.0, >= 1.0.5)
28
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- activejob (4.2.5.1)
30
- activesupport (= 4.2.5.1)
31
- globalid (>= 0.3.0)
32
- activemodel (4.2.5.1)
33
- activesupport (= 4.2.5.1)
34
- builder (~> 3.1)
35
- activerecord (4.2.5.1)
36
- activemodel (= 4.2.5.1)
37
- activesupport (= 4.2.5.1)
38
- arel (~> 6.0)
39
- activesupport (4.2.5.1)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.0.2)
34
+ activesupport (= 5.0.2)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.0.2)
37
+ activesupport (= 5.0.2)
38
+ activerecord (5.0.2)
39
+ activemodel (= 5.0.2)
40
+ activesupport (= 5.0.2)
41
+ arel (~> 7.0)
42
+ activesupport (5.0.2)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
40
44
  i18n (~> 0.7)
41
- json (~> 1.7, >= 1.7.7)
42
45
  minitest (~> 5.1)
43
- thread_safe (~> 0.3, >= 0.3.4)
44
46
  tzinfo (~> 1.1)
45
- arel (6.0.3)
46
- builder (3.2.2)
47
- concurrent-ruby (1.0.0)
47
+ arel (7.1.4)
48
+ builder (3.2.3)
49
+ byebug (9.0.6)
50
+ concurrent-ruby (1.0.5)
48
51
  diff-lcs (1.2.5)
49
52
  erubis (2.7.0)
50
- globalid (0.3.6)
51
- activesupport (>= 4.1.0)
52
- i18n (0.7.0)
53
- json (1.8.3)
53
+ globalid (0.4.0)
54
+ activesupport (>= 4.2.0)
55
+ i18n (0.8.1)
54
56
  loofah (2.0.3)
55
57
  nokogiri (>= 1.5.9)
56
- mail (2.6.3)
57
- mime-types (>= 1.16, < 3)
58
- mime-types (2.99)
59
- mini_portile2 (2.0.0)
60
- minitest (5.8.4)
61
- nokogiri (1.6.7.2)
62
- mini_portile2 (~> 2.0.0.rc2)
63
- rack (1.6.4)
58
+ mail (2.6.4)
59
+ mime-types (>= 1.16, < 4)
60
+ method_source (0.8.2)
61
+ mime-types (3.1)
62
+ mime-types-data (~> 3.2015)
63
+ mime-types-data (3.2016.0521)
64
+ mini_portile2 (2.1.0)
65
+ minitest (5.10.1)
66
+ nio4r (2.0.0)
67
+ nokogiri (1.7.1)
68
+ mini_portile2 (~> 2.1.0)
69
+ rack (2.0.1)
64
70
  rack-test (0.6.3)
65
71
  rack (>= 1.0)
66
- rails (4.2.5.1)
67
- actionmailer (= 4.2.5.1)
68
- actionpack (= 4.2.5.1)
69
- actionview (= 4.2.5.1)
70
- activejob (= 4.2.5.1)
71
- activemodel (= 4.2.5.1)
72
- activerecord (= 4.2.5.1)
73
- activesupport (= 4.2.5.1)
72
+ rails (5.0.2)
73
+ actioncable (= 5.0.2)
74
+ actionmailer (= 5.0.2)
75
+ actionpack (= 5.0.2)
76
+ actionview (= 5.0.2)
77
+ activejob (= 5.0.2)
78
+ activemodel (= 5.0.2)
79
+ activerecord (= 5.0.2)
80
+ activesupport (= 5.0.2)
74
81
  bundler (>= 1.3.0, < 2.0)
75
- railties (= 4.2.5.1)
76
- sprockets-rails
77
- rails-deprecated_sanitizer (1.0.3)
78
- activesupport (>= 4.2.0.alpha)
79
- rails-dom-testing (1.0.7)
80
- activesupport (>= 4.2.0.beta, < 5.0)
81
- nokogiri (~> 1.6.0)
82
- rails-deprecated_sanitizer (>= 1.0.1)
82
+ railties (= 5.0.2)
83
+ sprockets-rails (>= 2.0.0)
84
+ rails-dom-testing (2.0.2)
85
+ activesupport (>= 4.2.0, < 6.0)
86
+ nokogiri (~> 1.6)
83
87
  rails-html-sanitizer (1.0.3)
84
88
  loofah (~> 2.0)
85
- railties (4.2.5.1)
86
- actionpack (= 4.2.5.1)
87
- activesupport (= 4.2.5.1)
89
+ railties (5.0.2)
90
+ actionpack (= 5.0.2)
91
+ activesupport (= 5.0.2)
92
+ method_source
88
93
  rake (>= 0.8.7)
89
94
  thor (>= 0.18.1, < 2.0)
90
- rake (10.5.0)
95
+ rake (12.0.0)
91
96
  rspec (3.4.0)
92
97
  rspec-core (~> 3.4.0)
93
98
  rspec-expectations (~> 3.4.0)
@@ -101,24 +106,28 @@ GEM
101
106
  diff-lcs (>= 1.2.0, < 2.0)
102
107
  rspec-support (~> 3.4.0)
103
108
  rspec-support (3.4.1)
104
- sprockets (3.5.2)
109
+ sprockets (3.7.1)
105
110
  concurrent-ruby (~> 1.0)
106
111
  rack (> 1, < 3)
107
- sprockets-rails (3.0.1)
112
+ sprockets-rails (3.2.0)
108
113
  actionpack (>= 4.0)
109
114
  activesupport (>= 4.0)
110
115
  sprockets (>= 3.0.0)
111
- thor (0.19.1)
112
- thread_safe (0.3.5)
113
- tzinfo (1.2.2)
116
+ thor (0.19.4)
117
+ thread_safe (0.3.6)
118
+ tzinfo (1.2.3)
114
119
  thread_safe (~> 0.1)
120
+ websocket-driver (0.6.5)
121
+ websocket-extensions (>= 0.1.0)
122
+ websocket-extensions (0.1.2)
115
123
 
116
124
  PLATFORMS
117
125
  ruby
118
126
 
119
127
  DEPENDENCIES
128
+ byebug
120
129
  i18n_screwdriver!
121
130
  rspec
122
131
 
123
132
  BUNDLED WITH
124
- 1.10.6
133
+ 1.12.5
@@ -1 +1,3 @@
1
1
  I18n.locale = $("html").attr("lang")
2
+ I18n.onMissingTranslation ?= (md5, message) ->
3
+ "translation missing: #{I18n.locale}.#{message}"
@@ -6,5 +6,5 @@ interpolate = (message, data) ->
6
6
  I18n.screw = (message, data) ->
7
7
  md5 = window.md5(message)
8
8
  translation = I18n.translations[I18n.locale][md5]
9
- translation ?= ""
9
+ translation ?= I18n.onMissingTranslation(md5, message)
10
10
  interpolate(translation, data)
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # specify any dependencies here; for example:
23
23
  s.add_development_dependency "rspec"
24
+ s.add_development_dependency "byebug"
24
25
  s.add_runtime_dependency "rails", ">=3.0.0"
25
26
  end
26
27
 
@@ -10,9 +10,10 @@ module I18nScrewdriver
10
10
  File.join("config", "locales", "application.#{locale}.yml")
11
11
  end
12
12
 
13
- def self.generate_key(string)
14
- string = string.strip
15
- (string =~ /^:[a-z][a-z0-9_]*$/) ? string : Digest::MD5.hexdigest(string)
13
+ def self.generate_key(source)
14
+ return ":#{source}" if source.is_a?(Symbol)
15
+ source = source.strip
16
+ (source =~ /^:[a-z][a-z0-9_]*$/) ? source : Digest::MD5.hexdigest(source)
16
17
  end
17
18
 
18
19
  def self.file_with_translations_exists?(locale)
@@ -1,3 +1,3 @@
1
1
  module I18nScrewdriver
2
- VERSION = "9.2"
2
+ VERSION = "9.3"
3
3
  end
@@ -21,4 +21,20 @@ describe I18nScrewdriver do
21
21
  expect(I18nScrewdriver.grab_js_texts_to_be_translated(%|=I18n.screw(`Hi %{name}!`, name: "gucki")|)).to eq(["Hi %{name}!"])
22
22
  end
23
23
  end
24
+
25
+ describe "translates (oh really?)" do
26
+ before do
27
+ I18n.locale = :en
28
+ end
29
+ it "translate a string" do
30
+ expect(I18nScrewdriver.translate("good morning")).to eq("good morning")
31
+ I18n.locale = :it
32
+ expect(I18nScrewdriver.translate("good morning")).to eq("buongiorno")
33
+ end
34
+ it "translate a symbol" do
35
+ expect(I18nScrewdriver.translate(:intro_text)).to eq("a long intro text")
36
+ I18n.locale = :it
37
+ expect(I18nScrewdriver.translate(:intro_text)).to eq("un lungo testo introduttivo")
38
+ end
39
+ end
24
40
  end
@@ -0,0 +1,3 @@
1
+ en:
2
+ 2b849500e4585dab4196ec9a415edf8f: 'good morning'
3
+ ":intro_text": 'a long intro text'
@@ -0,0 +1,3 @@
1
+ it:
2
+ 2b849500e4585dab4196ec9a415edf8f: 'buongiorno'
3
+ ":intro_text": 'un lungo testo introduttivo'
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  require "bundler/setup"
2
2
  Bundler.setup
3
3
 
4
+ require 'byebug'
4
5
  require "i18n_screwdriver"
5
6
 
7
+ %w[en it].each {|locale| I18n.load_path << File.expand_path("../locales/#{locale}.yml", __FILE__) }
8
+
6
9
  RSpec.configure do |config|
7
10
  # some (optional) config here
8
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_screwdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: '9.2'
4
+ version: '9.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Miesel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-05 00:00:00.000000000 Z
12
+ date: 2017-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: byebug
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rails
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,8 @@ files:
66
80
  - lib/i18n_screwdriver/version.rb
67
81
  - lib/tasks/i18n.rake
68
82
  - spec/i18n_screwdriver_spec.rb
83
+ - spec/locales/en.yml
84
+ - spec/locales/it.yml
69
85
  - spec/spec_helper.rb
70
86
  homepage: https://github.com/agileapplications/i18n_screwdriver
71
87
  licenses:
@@ -87,10 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
103
  version: '0'
88
104
  requirements: []
89
105
  rubyforge_project: i18n_screwdriver
90
- rubygems_version: 2.5.1
106
+ rubygems_version: 2.6.6
91
107
  signing_key:
92
108
  specification_version: 4
93
109
  summary: make translating with rails i18n fun again
94
- test_files:
95
- - spec/i18n_screwdriver_spec.rb
96
- - spec/spec_helper.rb
110
+ test_files: []