i15r 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/i15r.rb +2 -11
- data/lib/i15r/pattern_matcher.rb +1 -1
- data/lib/i15r/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/i15r.rb
CHANGED
@@ -65,16 +65,6 @@ class I15R
|
|
65
65
|
@writer.write(path, i18ned_text) unless config.dry_run?
|
66
66
|
end
|
67
67
|
|
68
|
-
def display_indented_header(prefix)
|
69
|
-
puts "en:"
|
70
|
-
prefix_parts = prefix.split(".").each_with_index do |p, i|
|
71
|
-
p = "#{p}:"
|
72
|
-
#TODO: perhaps " "*i is simpler
|
73
|
-
(0..i).each { |i| p = " " + p }
|
74
|
-
puts "#{p}"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
68
|
def sub_plain_strings(text, prefix, file_type)
|
79
69
|
pm = I15R::PatternMatcher.new(prefix, file_type, :add_default => config.add_default)
|
80
70
|
transformed_text = pm.run(text) do |old_line, new_line|
|
@@ -84,7 +74,8 @@ class I15R
|
|
84
74
|
end
|
85
75
|
|
86
76
|
def internationalize!(path)
|
87
|
-
|
77
|
+
@printer.println "Running in dry-run mode" if config.dry_run?
|
78
|
+
path = "app" if path.nil?
|
88
79
|
files = File.directory?(path) ? Dir.glob("#{path}/**/*.{erb,haml}") : [path]
|
89
80
|
files.each { |file| internationalize_file(file) }
|
90
81
|
end
|
data/lib/i15r/pattern_matcher.rb
CHANGED
@@ -33,7 +33,7 @@ class I15R
|
|
33
33
|
def translation_key(text)
|
34
34
|
#TODO: downcase does not work properly for accented chars, like 'Ú', see function in ActiveSupport that deals with this
|
35
35
|
#TODO: [:punct:] would be nice but it includes _ which we don't want to remove
|
36
|
-
key = text.strip.downcase.gsub(/[\s\/]+/, '_').gsub(/[!?.,:"';()]/, '')
|
36
|
+
key = text.strip.downcase.gsub(/[\s\/]+/, '_').gsub(/[!?.,:"';()#\/\\]/, '')
|
37
37
|
"#{@prefix}.#{key}"
|
38
38
|
end
|
39
39
|
|
data/lib/i15r/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i15r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
segments:
|
173
173
|
- 0
|
174
|
-
hash: -
|
174
|
+
hash: -531769928414317979
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
176
|
none: false
|
177
177
|
requirements:
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
version: '0'
|
181
181
|
segments:
|
182
182
|
- 0
|
183
|
-
hash: -
|
183
|
+
hash: -531769928414317979
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
186
|
rubygems_version: 1.8.23
|