i18n_screwdriver 9.6 → 9.7

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
- SHA1:
3
- metadata.gz: f05ca18a8a326ce2103b234a9cba7721f1414e41
4
- data.tar.gz: b2e816b81e7b94230f7db598ea0264824af8e444
2
+ SHA256:
3
+ metadata.gz: 595b23ce883909f5ddd25889b49acc59d214179006299079bc0b24d90bc5adb4
4
+ data.tar.gz: 13933f51b2b28f2b085932356f51a34d27da180a0d157a443f231aaec363d3cf
5
5
  SHA512:
6
- metadata.gz: e4eb5d5dbd9790bb3a5cd20787f99d994388ca058c013d523f14d22924adb03fbea6744aefbea7a237f86803a9749e33eb765f5035e34079eb967ad6f61c886c
7
- data.tar.gz: adf221a1712c36d2f09a8b1fe8f4224cc4c36a042874508d926f1781434d1233ff4ffadf0badd0d0df49319e0b6026533b8df28b96c53f81a74a85c925b50fce
6
+ metadata.gz: 6f4cdd89623ee64b77e3cdd76d7043dbd2b03c0f48416258a76db2fbcc1613a89098c5f0b8641198d54e6fb694acfc958c99a53c6c73fb73439a50f10740e5da
7
+ data.tar.gz: 19202515d9c443b164af3d1c9f42726a7c1a20f69e5037c6fa45bd1c80685bcccd481d5c732b316b330b69fdc0e265ffa01b746efc1a9385da2a46f16a015822
@@ -7,10 +7,11 @@ module I18nScrewdriver
7
7
  Error = Class.new(StandardError)
8
8
 
9
9
  class << self
10
- attr_accessor :excluded_paths
10
+ attr_accessor :excluded_paths, :included_gems
11
11
  end
12
12
 
13
13
  self.excluded_paths = [%r{^tmp/}, %r{^node_modules/}, %r{/packs/}, %r{/packs-test}]
14
+ self.included_gems = []
14
15
 
15
16
  def self.filename_for_locale(locale)
16
17
  File.join("config", "locales", "application.#{locale}.yml")
@@ -103,11 +104,8 @@ module I18nScrewdriver
103
104
  excluded_paths.detect{ |excluded_path| path =~ excluded_path }
104
105
  end
105
106
 
106
- def self.gather_translations
107
- texts = []
108
- symbols = []
109
-
110
- Dir.glob("**/*.{haml,erb,slim,rb}").each do |file|
107
+ def self.gather_ruby_translations(path, texts, symbols)
108
+ Dir.glob("#{path}/**/*.{haml,erb,slim,rb}").each do |file|
111
109
  next unless File.file?(file)
112
110
  next if excluded_path?(file)
113
111
  puts "Scanning #{file}..."
@@ -115,14 +113,33 @@ module I18nScrewdriver
115
113
  texts.concat(grab_texts_to_be_translated(input))
116
114
  symbols.concat(grab_symbols_to_be_translated(input))
117
115
  end
116
+ end
118
117
 
119
- Dir.glob("**/*.{js,jsx,coffee,hamlc,ejs,erb}").each do |file|
118
+ def self.gather_js_translations(path, texts)
119
+ Dir.glob("#{path}/**/*.{js,jsx,coffee,hamlc,ejs,erb}").each do |file|
120
120
  next unless File.file?(file)
121
121
  next if excluded_path?(file)
122
122
  puts "Scanning #{file}..."
123
123
  input = File.read(file)
124
124
  texts.concat(grab_js_texts_to_be_translated(input))
125
125
  end
126
+ end
127
+
128
+ def self.gather_translations
129
+ texts = []
130
+ symbols = []
131
+
132
+ gather_ruby_translations(".", texts, symbols)
133
+ gather_js_translations(".", texts)
134
+
135
+ included_gems.each do |name|
136
+ spec = Gem.loaded_specs[name]
137
+ next puts "WARNING: gem #{name} not loaded, so it cannot be scanned for translations!" unless spec
138
+ spec.full_require_paths.each do |path|
139
+ gather_ruby_translations(path, texts, symbols)
140
+ gather_js_translations(path, texts)
141
+ end
142
+ end
126
143
 
127
144
  translations = Hash[texts.uniq.map{ |text| [generate_key(text), extract_text(text)] }]
128
145
  translations.merge(Hash[symbols.uniq.map{ |symbol| [generate_key(symbol), ""] }])
@@ -1,3 +1,3 @@
1
1
  module I18nScrewdriver
2
- VERSION = "9.6"
2
+ VERSION = "9.7"
3
3
  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.6'
4
+ version: '9.7'
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: 2017-12-03 00:00:00.000000000 Z
12
+ date: 2017-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -105,12 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project: i18n_screwdriver
108
- rubygems_version: 2.5.1
108
+ rubygems_version: 2.7.2
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: make translating with rails i18n fun again
112
- test_files:
113
- - spec/i18n_screwdriver_spec.rb
114
- - spec/locales/en.yml
115
- - spec/locales/it.yml
116
- - spec/spec_helper.rb
112
+ test_files: []