babelphish 0.4.2 → 0.4.3
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/VERSION +1 -1
- data/babelphish.gemspec +6 -7
- data/lib/babelphish/html_translator.rb +2 -2
- data/lib/babelphish/translator.rb +1 -1
- data/lib/babelphish/yml_translator.rb +4 -4
- data/lib/tasks/babelphish.rake +1 -1
- metadata +5 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/babelphish.gemspec
CHANGED
@@ -5,15 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{babelphish}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
13
|
-
s.default_executable = %q{babelphish}
|
11
|
+
s.authors = [%q{Justin Ball}, %q{Michael Jenik}]
|
12
|
+
s.date = %q{2011-05-18}
|
14
13
|
s.description = %q{Babelphish helps you make a quick translation of your application using Google Translate.}
|
15
14
|
s.email = %q{justinball@gmail.com}
|
16
|
-
s.executables = [
|
15
|
+
s.executables = [%q{babelphish}]
|
17
16
|
s.extra_rdoc_files = [
|
18
17
|
"LICENSE",
|
19
18
|
"README.rdoc"
|
@@ -71,8 +70,8 @@ Gem::Specification.new do |s|
|
|
71
70
|
"test/translations/en.yml"
|
72
71
|
]
|
73
72
|
s.homepage = %q{http://github.com/jbasdf/babelphish}
|
74
|
-
s.require_paths = [
|
75
|
-
s.rubygems_version = %q{1.
|
73
|
+
s.require_paths = [%q{lib}]
|
74
|
+
s.rubygems_version = %q{1.8.1}
|
76
75
|
s.summary = %q{Translate with Google like a fule => 'fool'}
|
77
76
|
s.test_files = [
|
78
77
|
"test/test_babelphish.rb",
|
@@ -51,13 +51,13 @@ module Babelphish
|
|
51
51
|
# Pull out all the code blocks so Google doesn't mess with those
|
52
52
|
pattern = /\<\%.+\%\>/
|
53
53
|
holder = '{{---}}'
|
54
|
-
replacements = text.scan(pattern)
|
54
|
+
replacements = text.to_s.scan(pattern)
|
55
55
|
text.gsub!(pattern, holder)
|
56
56
|
|
57
57
|
# Pull out all the new lines so Google doesn't mess with those
|
58
58
|
pattern = /\n/
|
59
59
|
newline_holder = '<brr />'
|
60
|
-
newline_replacements = text.scan(pattern)
|
60
|
+
newline_replacements = text.to_s.scan(pattern)
|
61
61
|
text.gsub!(pattern, newline_holder)
|
62
62
|
|
63
63
|
# Send to Google for translations
|
@@ -91,7 +91,7 @@ module Babelphish
|
|
91
91
|
# {"responseData": [{"responseData":{"translatedText":"ciao mondo"},"responseDetails":null,"responseStatus":200},{"responseData":{"translatedText":"Bonjour le Monde"},"responseDetails":null,"responseStatus":200}], "responseDetails": null, "responseStatus": 200}
|
92
92
|
#
|
93
93
|
def multiple_translate(text, tos, from = 'en', tries = 0)
|
94
|
-
return {} if text.strip.empty? # Google doesn't like it when you send them an empty string
|
94
|
+
return {} if text.to_s.strip.empty? # Google doesn't like it when you send them an empty string
|
95
95
|
|
96
96
|
tos.each do |to|
|
97
97
|
if !Babelphish::GoogleTranslate::LANGUAGES.include?(to)
|
@@ -128,13 +128,13 @@ module Babelphish
|
|
128
128
|
def add_substitutions(translate_text)
|
129
129
|
# pull out all the string substitutions so that google doesn't translate those
|
130
130
|
pattern = /\{\{.+?\}\}/ # non greedy pattern match so that we properly match strings like: "{{name}} on {{application_name}}"
|
131
|
-
@replacements = translate_text.scan(pattern)
|
132
|
-
translate_text.gsub!(pattern, SUBSTITUTION_PLACE_HOLDER)
|
131
|
+
@replacements = translate_text.to_s.scan(pattern)
|
132
|
+
translate_text.to_s.gsub!(pattern, SUBSTITUTION_PLACE_HOLDER)
|
133
133
|
|
134
134
|
# Pull out all the translation blocks so Google doesn't mess with those
|
135
135
|
pattern = /%\{.+?\}/
|
136
|
-
@replacements2 = translate_text.scan(pattern)
|
137
|
-
translate_text.gsub!(pattern, SUBSTITUTION_PLACE_HOLDER_2)
|
136
|
+
@replacements2 = translate_text.to_s.scan(pattern)
|
137
|
+
translate_text.to_s.gsub!(pattern, SUBSTITUTION_PLACE_HOLDER_2)
|
138
138
|
end
|
139
139
|
|
140
140
|
def remove_substitutions(translate_text)
|
data/lib/tasks/babelphish.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: babelphish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable: babelphish
|
19
|
+
date: 2011-05-18 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: ya2yaml
|
@@ -107,7 +106,6 @@ files:
|
|
107
106
|
- test/test_html_translator.rb
|
108
107
|
- test/test_yml_translator.rb
|
109
108
|
- test/translations/en.yml
|
110
|
-
has_rdoc: true
|
111
109
|
homepage: http://github.com/jbasdf/babelphish
|
112
110
|
licenses: []
|
113
111
|
|
@@ -137,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
135
|
requirements: []
|
138
136
|
|
139
137
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.
|
138
|
+
rubygems_version: 1.8.1
|
141
139
|
signing_key:
|
142
140
|
specification_version: 3
|
143
141
|
summary: Translate with Google like a fule => 'fool'
|