i18n_screwdriver 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +25 -25
- data/lib/i18n_screwdriver/version.rb +1 -1
- data/lib/i18n_screwdriver.rb +31 -0
- data/lib/tasks/i18n.rake +3 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
i18n_screwdriver (2.0.
|
4
|
+
i18n_screwdriver (2.0.1)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (3.2.
|
11
|
-
actionpack (= 3.2.
|
10
|
+
actionmailer (3.2.6)
|
11
|
+
actionpack (= 3.2.6)
|
12
12
|
mail (~> 2.4.4)
|
13
|
-
actionpack (3.2.
|
14
|
-
activemodel (= 3.2.
|
15
|
-
activesupport (= 3.2.
|
13
|
+
actionpack (3.2.6)
|
14
|
+
activemodel (= 3.2.6)
|
15
|
+
activesupport (= 3.2.6)
|
16
16
|
builder (~> 3.0.0)
|
17
17
|
erubis (~> 2.7.0)
|
18
18
|
journey (~> 1.0.1)
|
@@ -20,18 +20,18 @@ GEM
|
|
20
20
|
rack-cache (~> 1.2)
|
21
21
|
rack-test (~> 0.6.1)
|
22
22
|
sprockets (~> 2.1.3)
|
23
|
-
activemodel (3.2.
|
24
|
-
activesupport (= 3.2.
|
23
|
+
activemodel (3.2.6)
|
24
|
+
activesupport (= 3.2.6)
|
25
25
|
builder (~> 3.0.0)
|
26
|
-
activerecord (3.2.
|
27
|
-
activemodel (= 3.2.
|
28
|
-
activesupport (= 3.2.
|
26
|
+
activerecord (3.2.6)
|
27
|
+
activemodel (= 3.2.6)
|
28
|
+
activesupport (= 3.2.6)
|
29
29
|
arel (~> 3.0.2)
|
30
30
|
tzinfo (~> 0.3.29)
|
31
|
-
activeresource (3.2.
|
32
|
-
activemodel (= 3.2.
|
33
|
-
activesupport (= 3.2.
|
34
|
-
activesupport (3.2.
|
31
|
+
activeresource (3.2.6)
|
32
|
+
activemodel (= 3.2.6)
|
33
|
+
activesupport (= 3.2.6)
|
34
|
+
activesupport (3.2.6)
|
35
35
|
i18n (~> 0.6)
|
36
36
|
multi_json (~> 1.0)
|
37
37
|
arel (3.0.2)
|
@@ -56,17 +56,17 @@ GEM
|
|
56
56
|
rack
|
57
57
|
rack-test (0.6.1)
|
58
58
|
rack (>= 1.0)
|
59
|
-
rails (3.2.
|
60
|
-
actionmailer (= 3.2.
|
61
|
-
actionpack (= 3.2.
|
62
|
-
activerecord (= 3.2.
|
63
|
-
activeresource (= 3.2.
|
64
|
-
activesupport (= 3.2.
|
59
|
+
rails (3.2.6)
|
60
|
+
actionmailer (= 3.2.6)
|
61
|
+
actionpack (= 3.2.6)
|
62
|
+
activerecord (= 3.2.6)
|
63
|
+
activeresource (= 3.2.6)
|
64
|
+
activesupport (= 3.2.6)
|
65
65
|
bundler (~> 1.0)
|
66
|
-
railties (= 3.2.
|
67
|
-
railties (3.2.
|
68
|
-
actionpack (= 3.2.
|
69
|
-
activesupport (= 3.2.
|
66
|
+
railties (= 3.2.6)
|
67
|
+
railties (3.2.6)
|
68
|
+
actionpack (= 3.2.6)
|
69
|
+
activesupport (= 3.2.6)
|
70
70
|
rack-ssl (~> 1.3.2)
|
71
71
|
rake (>= 0.8.7)
|
72
72
|
rdoc (~> 3.4)
|
data/lib/i18n_screwdriver.rb
CHANGED
@@ -40,5 +40,36 @@ module I18nScrewdriver
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
def self.unescape_string(string)
|
45
|
+
"".tap do |result|
|
46
|
+
in_backslash = false
|
47
|
+
string.each_char do |char|
|
48
|
+
if in_backslash
|
49
|
+
case char
|
50
|
+
when 'r'
|
51
|
+
result << "\r"
|
52
|
+
when 'n'
|
53
|
+
result << "\n"
|
54
|
+
when 't'
|
55
|
+
result << "\t"
|
56
|
+
when '\\'
|
57
|
+
result << '\\'
|
58
|
+
else
|
59
|
+
result << '\\'
|
60
|
+
result << char
|
61
|
+
end
|
62
|
+
in_backslash = false
|
63
|
+
else
|
64
|
+
case char
|
65
|
+
when '\\'
|
66
|
+
in_backslash = true
|
67
|
+
else
|
68
|
+
result << char
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
43
74
|
end
|
44
75
|
|
data/lib/tasks/i18n.rake
CHANGED
@@ -25,6 +25,9 @@ namespace :i18n do
|
|
25
25
|
texts.concat(I18nScrewdriver.grab_texts_to_be_translated(File.read(file)))
|
26
26
|
end
|
27
27
|
|
28
|
+
# properly handle character codes in strings (\n, \r, \t, \\)
|
29
|
+
texts.map!{ |text| I18nScrewdriver.unescape_string(text) }
|
30
|
+
|
28
31
|
# remove duplicates
|
29
32
|
texts.uniq!
|
30
33
|
|
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: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
segments:
|
80
80
|
- 0
|
81
|
-
hash:
|
81
|
+
hash: -12614887009527273
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
segments:
|
89
89
|
- 0
|
90
|
-
hash:
|
90
|
+
hash: -12614887009527273
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project: i18n_screwdriver
|
93
93
|
rubygems_version: 1.8.24
|