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 +5 -5
- data/lib/i18n_screwdriver.rb +24 -7
- data/lib/i18n_screwdriver/version.rb +1 -1
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 595b23ce883909f5ddd25889b49acc59d214179006299079bc0b24d90bc5adb4
|
4
|
+
data.tar.gz: 13933f51b2b28f2b085932356f51a34d27da180a0d157a443f231aaec363d3cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f4cdd89623ee64b77e3cdd76d7043dbd2b03c0f48416258a76db2fbcc1613a89098c5f0b8641198d54e6fb694acfc958c99a53c6c73fb73439a50f10740e5da
|
7
|
+
data.tar.gz: 19202515d9c443b164af3d1c9f42726a7c1a20f69e5037c6fa45bd1c80685bcccd481d5c732b316b330b69fdc0e265ffa01b746efc1a9385da2a46f16a015822
|
data/lib/i18n_screwdriver.rb
CHANGED
@@ -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.
|
107
|
-
|
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
|
-
|
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), ""] }])
|
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.
|
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-
|
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.
|
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: []
|