to_lang 0.2.2 → 0.3.0
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/Guardfile +5 -0
- data/README.textile +46 -8
- data/bin/to_lang +40 -0
- data/lib/to_lang.rb +7 -6
- data/lib/to_lang/codemap.rb +1 -1
- data/lib/to_lang/connector.rb +25 -9
- data/lib/to_lang/{string_methods.rb → translatable.rb} +3 -3
- data/lib/to_lang/version.rb +1 -1
- data/spec/to_lang/connector_spec.rb +61 -37
- data/spec/to_lang/{string_methods_spec.rb → translatable_spec.rb} +1 -1
- data/spec/to_lang_spec.rb +6 -2
- data/to_lang.gemspec +12 -9
- metadata +53 -47
data/Guardfile
ADDED
data/README.textile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
h1. to_lang
|
2
2
|
|
3
|
-
*to_lang* is a Ruby library that adds language translation methods to strings, backed by the Google Translate API.
|
3
|
+
*to_lang* is a Ruby library that adds language translation methods to strings and arrays, backed by the Google Translate API.
|
4
4
|
|
5
5
|
h2. Installation
|
6
6
|
|
@@ -10,13 +10,13 @@ h2. Usage
|
|
10
10
|
|
11
11
|
To use *to_lang*, require the library, then call @ToLang.start@ with your Google Translate API key. At this point you will have access to all the new translation methods, which take the form @to_language@, where "language" is the language you wish to translate to.
|
12
12
|
|
13
|
-
Google Translate attempts to detect the source language, but you can specify it explicitly by calling methods in the form @to_target_language_from_source_language@, where "target language" is the language you are translating to and "source_language" is the language you are starting with. An inverted form with equivalent functionality, @from_source_language_to_target_language@ is also available. These methods are generated dynamically and will not appear in a
|
13
|
+
Google Translate attempts to detect the source language, but you can specify it explicitly by calling methods in the form @to_target_language_from_source_language@, where "target language" is the language you are translating to and "source_language" is the language you are starting with. An inverted form with equivalent functionality, @from_source_language_to_target_language@ is also available. These methods are generated dynamically and will not appear in a calls to @String.instance_methods@ or @Array.instance_methods@ until they have been called once. Strings and arrays will, however, @respond_to?@ these methods prior to their dynamic definition.
|
14
14
|
|
15
|
-
The dynamic methods are simply syntactic sugar for @String#translate@, which you can use directly as well.
|
15
|
+
The dynamic methods are simply syntactic sugar for @String#translate@ and @Array#translate@, which you can use directly as well.
|
16
16
|
|
17
|
-
|
17
|
+
*to_lang* also comes with a command line utility for quick translations from the shell.
|
18
18
|
|
19
|
-
h2. Examples
|
19
|
+
h2. String Examples
|
20
20
|
|
21
21
|
Load and initialize *to_lang*:
|
22
22
|
|
@@ -52,9 +52,17 @@ Using @String#translate@ directly:
|
|
52
52
|
=> "un pastel"
|
53
53
|
</code></pre>
|
54
54
|
|
55
|
+
h2. Array Examples
|
56
|
+
|
57
|
+
Arrays can be used to translate a batch of strings in a single method call and a single HTTP request. The exact same methods shown above work for arrays as well. For example, to translate an array of strings to Spanish:
|
58
|
+
|
59
|
+
<pre><code>["One", "Two", "Three"].to_spanish
|
60
|
+
=> ["Uno", "Dos", "Tres"]
|
61
|
+
</code></pre>
|
62
|
+
|
55
63
|
h2. Debugging
|
56
64
|
|
57
|
-
@
|
65
|
+
@translate@ also has the advantage of allowing you to get debug output for a translation. @translate@ accepts a @:debug@ option with three possible values: @:request@, @:response@, and @:all@. @:request@ will cause the method to return a hash of the parameters that will be sent to the Google Translate API. @:response@ will cause the method to return the full response from the API call as a hash. @:all@ will cause the method to return a hash which contains both the request hash and the full response.
|
58
66
|
|
59
67
|
<pre><code>"hello world".translate('es', :debug => :request)
|
60
68
|
=> {:key=>"my_key", :q=>"hello world", :target=>"es"}
|
@@ -70,9 +78,39 @@ h2. Debugging
|
|
70
78
|
"detectedSourceLanguage"=>"en"}]}}}
|
71
79
|
</code></pre>
|
72
80
|
|
81
|
+
h2. Command Line Interface
|
82
|
+
|
83
|
+
The command line utility @to_lang@ has the following interface:
|
84
|
+
|
85
|
+
@to_lang [--key API_KEY] [--from SOURCE_LANGUAGE] --to DESTINATION_LANGUAGE STRING [STRING, ...]@
|
86
|
+
|
87
|
+
@to_lang@ accepts a space separated list of strings to translate. At least one string is required, as is the @--to@ option, which accepts a language code (e.g. "es"). @to_lang@ will attempt to load a Google Translate API key from the @GOOGLE_TRANSLATE_API_KEY@ environment variable. If one is not available, it must be passed in from the command line with the @--key@ option. For complete usage instructions, invoke the utility with the @--help@ option.
|
88
|
+
|
89
|
+
Examples:
|
90
|
+
|
91
|
+
A simple translation with the key being passed in directly from the command line:
|
92
|
+
|
93
|
+
<pre><code>$ to_lang --key YOUR_GOOGLE_TRANSLATE_API_KEY --to es "hello world"
|
94
|
+
hola mundo
|
95
|
+
</code></pre>
|
96
|
+
|
97
|
+
With the key in an environment variable and multiple strings:
|
98
|
+
|
99
|
+
<pre><code>$ to_lang --to es "hello world" "a pie"
|
100
|
+
hola mundo
|
101
|
+
a pie
|
102
|
+
</code></pre>
|
103
|
+
|
104
|
+
Specifying the source language:
|
105
|
+
|
106
|
+
<pre><code>$ to_lang --from en --to es "hello world" "a pie"
|
107
|
+
hola mundo
|
108
|
+
un pastel
|
109
|
+
</code></pre>
|
110
|
+
|
73
111
|
h2. Supported Languages
|
74
112
|
|
75
|
-
*to_lang* adds the following methods to strings. Each of these methods can be called with an explicit source language by appending @_from_source_language@ or prepending @from_source_language_@ to the method name.
|
113
|
+
*to_lang* adds the following methods to strings and arrays. Each of these methods can be called with an explicit source language by appending @_from_source_language@ or prepending @from_source_language_@ to the method name.
|
76
114
|
|
77
115
|
* to_afrikaans
|
78
116
|
* to_albanian
|
@@ -133,4 +171,4 @@ API documentation can be found at "rubydoc.info":http://rubydoc.info/github/jimm
|
|
133
171
|
|
134
172
|
h2. Feedback and Contributions
|
135
173
|
|
136
|
-
Feedback is greatly appreciated. If you have any problems with *to_lang*, please open a new issue. Make sure you are using the latest version of the gem, or HEAD if you've cloned the Git repository directly. Please include debugging output from using
|
174
|
+
Feedback is greatly appreciated. If you have any problems with *to_lang*, please open a new issue. Make sure you are using the latest version of the gem, or HEAD if you've cloned the Git repository directly. Please include debugging output from using the @:debug@ option of @translate@, if relevant to your issue. If you'd like to fix bugs, add features, or improve the library in general, feel free to fork the project and send me a pull request with your changes.
|
data/bin/to_lang
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "optparse"
|
3
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
4
|
+
require "to_lang/version"
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
OptionParser.new do |o|
|
8
|
+
o.banner = "Usage: to_lang [--key API_KEY] [--from SOURCE_LANGUAGE] --to DESTINATION_LANGUAGE STRING [STRING, ...]"
|
9
|
+
|
10
|
+
o.on("--key API_KEY", "A Google Translate API key", "(Will attempt to use ENV['GOOGLE_TRANSLATE_API_KEY'] if not supplied)") do |key|
|
11
|
+
options[:key] = key
|
12
|
+
end
|
13
|
+
|
14
|
+
o.on("--from SOURCE", "The source language") do |source|
|
15
|
+
options[:from] = source
|
16
|
+
end
|
17
|
+
|
18
|
+
o.on("--to DESTINATION", "The destination language") do |destination|
|
19
|
+
options[:to] = destination
|
20
|
+
end
|
21
|
+
|
22
|
+
o.on("-v", "--version", "The current version of ToLang") do
|
23
|
+
puts "ToLang v#{ToLang::VERSION}"
|
24
|
+
exit
|
25
|
+
end
|
26
|
+
|
27
|
+
o.on("-h", "--help", "This help screen") do
|
28
|
+
puts o
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
end.parse!
|
32
|
+
|
33
|
+
options[:key] ||= ENV['GOOGLE_TRANSLATE_API_KEY']
|
34
|
+
abort "A Google Translate API key is required" unless options[:key]
|
35
|
+
abort "A valid destination language is required" unless options[:to]
|
36
|
+
abort "At least one string to translate is required" unless ARGV.size >= 1
|
37
|
+
|
38
|
+
require "to_lang"
|
39
|
+
ToLang.start(options[:key])
|
40
|
+
puts ARGV.translate(options[:to], :from => options[:from])
|
data/lib/to_lang.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "to_lang/connector"
|
2
|
-
require "to_lang/
|
2
|
+
require "to_lang/translatable"
|
3
3
|
|
4
4
|
$KCODE = 'u' unless RUBY_VERSION >= "1.9"
|
5
5
|
|
6
|
-
# {ToLang} is a Ruby library that adds language translation methods to strings, backed by the Google Translate API.
|
6
|
+
# {ToLang} is a Ruby library that adds language translation methods to strings and arrays, backed by the Google Translate API.
|
7
7
|
#
|
8
8
|
# @author Jimmy Cuadra
|
9
9
|
# @see https://github.com/jimmycuadra/to_lang Source on GitHub
|
@@ -16,16 +16,17 @@ module ToLang
|
|
16
16
|
#
|
17
17
|
attr_reader :connector
|
18
18
|
|
19
|
-
# Initializes {ToLang}, after which the translation methods will be available from strings.
|
19
|
+
# Initializes {ToLang}, after which the translation methods will be available from strings and arrays.
|
20
20
|
#
|
21
21
|
# @param [String] key A Google Translate API key.
|
22
22
|
#
|
23
|
-
# @return [Class, Boolean] @
|
23
|
+
# @return [Class, Boolean] @Array@ if initialization succeeded, @false@ if this method has already been called successfully.
|
24
24
|
#
|
25
25
|
def start(key)
|
26
26
|
return false if defined?(@connector) && !@connector.nil?
|
27
|
-
@connector =
|
28
|
-
String.send
|
27
|
+
@connector = Connector.new key
|
28
|
+
String.send :include, Translatable
|
29
|
+
Array.send :include, Translatable
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/to_lang/codemap.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module ToLang
|
2
|
-
# A list of all the languages {ToLang} supports and the language code each maps to. Strings will gain @to_language@, @to_language_from_language@, and @from_language_to_language@ methods for any @language@ in this list.
|
2
|
+
# A list of all the languages {ToLang} supports and the language code each maps to. Strings and arrays will gain @to_language@, @to_language_from_language@, and @from_language_to_language@ methods for any @language@ in this list.
|
3
3
|
#
|
4
4
|
CODEMAP = {
|
5
5
|
'afrikaans' => 'af',
|
data/lib/to_lang/connector.rb
CHANGED
@@ -11,9 +11,20 @@ module ToLang
|
|
11
11
|
#
|
12
12
|
API_URL = "https://www.googleapis.com/language/translate/v2"
|
13
13
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
14
|
+
# A custom query string normalizer that does not sort arguments. This is necessary to ensure that batch translations
|
15
|
+
# are returned in the same order they appear in the input array.
|
16
|
+
UNSORTED_QUERY_STRING_NORMALIZER = proc do |query|
|
17
|
+
Array(query).map do |key, value|
|
18
|
+
if value.nil?
|
19
|
+
key
|
20
|
+
elsif value.is_a?(Array)
|
21
|
+
value.map {|v| "#{key}=#{URI.encode(v.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}"}
|
22
|
+
else
|
23
|
+
{key => value}.to_params
|
24
|
+
end
|
25
|
+
end.flatten.join('&')
|
26
|
+
end
|
27
|
+
query_string_normalizer UNSORTED_QUERY_STRING_NORMALIZER
|
17
28
|
|
18
29
|
# The Google Translate API key to use when making API calls.
|
19
30
|
#
|
@@ -31,18 +42,16 @@ module ToLang
|
|
31
42
|
|
32
43
|
# Makes a request to the Google Translate API.
|
33
44
|
#
|
34
|
-
# @param [String] q
|
45
|
+
# @param [String, Array] q A string or array of strings to translate.
|
35
46
|
# @param [String] target The language code for the language to translate to.
|
36
47
|
# @param [Hash] options A hash of options.
|
37
48
|
# @option options [String] :from The language code for the language of @q@.
|
38
49
|
# @option options [Symbol] :debug Debug output to return instead of the translated string. Must be one of @:request@, @:response@, or @:all@.
|
39
50
|
#
|
40
|
-
# @raise [RuntimeError] If
|
41
|
-
# @return [String, Hash] The translated string or debugging output, as requested.
|
51
|
+
# @raise [RuntimeError] If Google Translate returns any errors.
|
52
|
+
# @return [String, Array, Hash] The translated string, an array of the translated strings, or debugging output, as requested.
|
42
53
|
#
|
43
54
|
def request(q, target, options = {})
|
44
|
-
raise "The string to translate cannot be greater than #{MAX_STRING_LENGTH} characters" if q.size > MAX_STRING_LENGTH
|
45
|
-
|
46
55
|
request_hash = { :key => @key, :q => q, :target => target }
|
47
56
|
request_hash[:source] = options[:from] if options[:from]
|
48
57
|
return request_hash if options[:debug] == :request
|
@@ -52,7 +61,14 @@ module ToLang
|
|
52
61
|
return { :request => request_hash, :response => response.parsed_response } if options[:debug] == :all
|
53
62
|
|
54
63
|
raise response.parsed_response["error"]["message"] if response.parsed_response["error"] && response.parsed_response["error"]["message"]
|
55
|
-
|
64
|
+
|
65
|
+
translations = response.parsed_response["data"]["translations"]
|
66
|
+
|
67
|
+
if translations.size > 1
|
68
|
+
translations.map { |translation| CGI.unescapeHTML translation["translatedText"] }
|
69
|
+
else
|
70
|
+
CGI.unescapeHTML(translations[0]["translatedText"])
|
71
|
+
end
|
56
72
|
end
|
57
73
|
end
|
58
74
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "to_lang/codemap"
|
2
2
|
|
3
3
|
module ToLang
|
4
|
-
#
|
4
|
+
# {ToLang}'s core translation methods.
|
5
5
|
#
|
6
|
-
module
|
7
|
-
# Translates a string to another language. All the magic methods use this internally. It, in turn, forwards
|
6
|
+
module Translatable
|
7
|
+
# Translates a string or array of strings to another language. All the magic methods use this internally. It, in turn, forwards
|
8
8
|
# everything on to {ToLang::Connector#request}
|
9
9
|
#
|
10
10
|
# @param [String] target The language code for the language to translate to.
|
data/lib/to_lang/version.rb
CHANGED
@@ -5,11 +5,24 @@ describe ToLang::Connector do
|
|
5
5
|
@connector = ToLang::Connector.new('apikey')
|
6
6
|
end
|
7
7
|
|
8
|
+
describe "custom query string normalizer" do
|
9
|
+
it "returns a query string with unsorted parameters" do
|
10
|
+
params = {
|
11
|
+
:key_with_no_value => nil,
|
12
|
+
:key => 'apikey',
|
13
|
+
:target => 'es',
|
14
|
+
:q => ["banana", "apple"]
|
15
|
+
}
|
16
|
+
ToLang::Connector::UNSORTED_QUERY_STRING_NORMALIZER.call(params).should == "key_with_no_value&key=apikey&target=es&q=banana&q=apple"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
it "stores a key when initialized" do
|
9
21
|
@connector.key.should_not be_nil
|
10
22
|
end
|
11
23
|
|
12
24
|
describe "#request" do
|
25
|
+
# helper methods
|
13
26
|
def stub_response(parsed_response)
|
14
27
|
mock_response = mock('HTTParty::Response', :parsed_response => parsed_response)
|
15
28
|
ToLang::Connector.stub(:post).and_return(mock_response)
|
@@ -27,60 +40,71 @@ describe ToLang::Connector do
|
|
27
40
|
parsed_response
|
28
41
|
end
|
29
42
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
43
|
+
def stub_good_array_response(translated_texts)
|
44
|
+
parsed_response = { "data" => { "translations" => [] } }
|
45
|
+
translated_texts.each { |text| parsed_response["data"]["translations"].push({ "translatedText" => text }) }
|
46
|
+
stub_response(parsed_response)
|
47
|
+
parsed_response
|
35
48
|
end
|
36
49
|
|
37
|
-
context "
|
38
|
-
context "
|
39
|
-
it "returns the
|
40
|
-
stub_good_response "
|
41
|
-
@connector.request("
|
50
|
+
context "given a single string" do
|
51
|
+
context "with only a target language" do
|
52
|
+
it "returns the translated string" do
|
53
|
+
stub_good_response "hola mundo"
|
54
|
+
@connector.request("hello world", "es").should == "hola mundo"
|
42
55
|
end
|
43
56
|
end
|
44
57
|
|
45
|
-
context "
|
46
|
-
|
47
|
-
|
48
|
-
|
58
|
+
context "with an ambiguous source language" do
|
59
|
+
context "and no source language specified" do
|
60
|
+
it "returns the same string" do
|
61
|
+
stub_good_response "a pie"
|
62
|
+
@connector.request("a pie", "es").should == "a pie"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "and a source language specified" do
|
67
|
+
it "returns the translated string" do
|
68
|
+
stub_good_response "un pastel"
|
69
|
+
@connector.request("a pie", "es", :from => "en").should == "un pastel"
|
70
|
+
end
|
49
71
|
end
|
50
72
|
end
|
51
|
-
end
|
52
73
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
74
|
+
context "with a bad language pair" do
|
75
|
+
it "raises an exception" do
|
76
|
+
stub_bad_response "Bad language pair: en|en"
|
77
|
+
expect { @connector.request("a pie", "en", :from => "en") }.to raise_error(RuntimeError, "Bad language pair: en|en")
|
78
|
+
end
|
57
79
|
end
|
58
|
-
end
|
59
80
|
|
60
|
-
|
61
|
-
|
62
|
-
|
81
|
+
context "when debugging the request" do
|
82
|
+
it "returns the request URL" do
|
83
|
+
@connector.request("hello world", "es", :from => "en", :debug => :request).should == { :key=> "apikey", :q => "hello world", :target => "es", :source => "en" }
|
84
|
+
end
|
63
85
|
end
|
64
|
-
end
|
65
86
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
87
|
+
context "when debugging the response" do
|
88
|
+
it "returns the full parsed response" do
|
89
|
+
expected_response = stub_good_response("hola mundo")
|
90
|
+
@connector.request("hello world", "es", :from => "en", :debug => :response).should == expected_response
|
91
|
+
end
|
70
92
|
end
|
71
|
-
end
|
72
93
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
94
|
+
context "when debugging the request and the response" do
|
95
|
+
it "returns a hash with the request URL and the full parsed response" do
|
96
|
+
expected_response = stub_good_response("hola mundo")
|
97
|
+
output = @connector.request("hello world", "es", :from => "en", :debug => :all)
|
98
|
+
output.should == { :request => { :key=> "apikey", :q => "hello world", :target => "es", :source => "en" }, :response => expected_response }
|
99
|
+
end
|
78
100
|
end
|
79
101
|
end
|
80
102
|
|
81
|
-
|
82
|
-
|
83
|
-
|
103
|
+
context "given an array of strings" do
|
104
|
+
it "returns an array of translated strings" do
|
105
|
+
stub_good_array_response ["hola", "mundo"]
|
106
|
+
@connector.request(["hello", "world"], "es").should == ["hola", "mundo"]
|
107
|
+
end
|
84
108
|
end
|
85
109
|
end
|
86
110
|
end
|
data/spec/to_lang_spec.rb
CHANGED
@@ -14,8 +14,12 @@ describe ToLang do
|
|
14
14
|
ToLang.connector.should be_an_instance_of ToLang::Connector
|
15
15
|
end
|
16
16
|
|
17
|
-
it "mixes
|
18
|
-
String.should include ToLang::
|
17
|
+
it "mixes Translatable into String" do
|
18
|
+
String.should include ToLang::Translatable
|
19
|
+
end
|
20
|
+
|
21
|
+
it "mixes Translatable into Array" do
|
22
|
+
Array.should include ToLang::Translatable
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
data/to_lang.gemspec
CHANGED
@@ -8,19 +8,22 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Jimmy Cuadra"]
|
9
9
|
s.email = ["jimmy@jimmycuadra.com"]
|
10
10
|
s.homepage = "https://github.com/jimmycuadra/to_lang"
|
11
|
-
s.summary = %q{
|
12
|
-
s.description = %q{Adds language translation methods to strings, backed by the Google Translate API}
|
11
|
+
s.summary = %q{Translate strings with Google Translate}
|
12
|
+
s.description = %q{Adds language translation methods to strings and arrays, backed by the Google Translate API}
|
13
13
|
s.rubyforge_project = s.name
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency "httparty", "~> 0.
|
20
|
-
s.add_development_dependency "bundler", "~> 1.0"
|
21
|
-
s.add_development_dependency "rake", "~> 0.8"
|
22
|
-
s.add_development_dependency "rspec", "~> 2.
|
23
|
-
s.add_development_dependency "simplecov", "~> 0.
|
24
|
-
s.add_development_dependency "yard", "~> 0.6"
|
25
|
-
s.add_development_dependency "RedCloth", "~> 4.2"
|
19
|
+
s.add_dependency "httparty", "~> 0.7.0"
|
20
|
+
s.add_development_dependency "bundler", "~> 1.0.10"
|
21
|
+
s.add_development_dependency "rake", "~> 0.8.7"
|
22
|
+
s.add_development_dependency "rspec", "~> 2.5.0"
|
23
|
+
s.add_development_dependency "simplecov", "~> 0.4.1"
|
24
|
+
s.add_development_dependency "yard", "~> 0.6.5"
|
25
|
+
s.add_development_dependency "RedCloth", "~> 4.2.7"
|
26
|
+
s.add_development_dependency "guard-rspec", "~> 0.2.0"
|
27
|
+
s.add_development_dependency "rb-fsevent", "~> 0.4.0" if RUBY_PLATFORM[/darwin/]
|
28
|
+
s.add_development_dependency "growl", "~> 1.0.3" if RUBY_PLATFORM[/darwin/]
|
26
29
|
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 2
|
9
|
-
version: 0.2.2
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jimmy Cuadra
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-14 00:00:00 -07:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,10 +21,7 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
- 6
|
31
|
-
version: "0.6"
|
24
|
+
version: 0.7.0
|
32
25
|
type: :runtime
|
33
26
|
version_requirements: *id001
|
34
27
|
- !ruby/object:Gem::Dependency
|
@@ -39,10 +32,7 @@ dependencies:
|
|
39
32
|
requirements:
|
40
33
|
- - ~>
|
41
34
|
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
- 1
|
44
|
-
- 0
|
45
|
-
version: "1.0"
|
35
|
+
version: 1.0.10
|
46
36
|
type: :development
|
47
37
|
version_requirements: *id002
|
48
38
|
- !ruby/object:Gem::Dependency
|
@@ -53,10 +43,7 @@ dependencies:
|
|
53
43
|
requirements:
|
54
44
|
- - ~>
|
55
45
|
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
- 0
|
58
|
-
- 8
|
59
|
-
version: "0.8"
|
46
|
+
version: 0.8.7
|
60
47
|
type: :development
|
61
48
|
version_requirements: *id003
|
62
49
|
- !ruby/object:Gem::Dependency
|
@@ -67,10 +54,7 @@ dependencies:
|
|
67
54
|
requirements:
|
68
55
|
- - ~>
|
69
56
|
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
- 2
|
72
|
-
- 3
|
73
|
-
version: "2.3"
|
57
|
+
version: 2.5.0
|
74
58
|
type: :development
|
75
59
|
version_requirements: *id004
|
76
60
|
- !ruby/object:Gem::Dependency
|
@@ -81,10 +65,7 @@ dependencies:
|
|
81
65
|
requirements:
|
82
66
|
- - ~>
|
83
67
|
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
- 0
|
86
|
-
- 3
|
87
|
-
version: "0.3"
|
68
|
+
version: 0.4.1
|
88
69
|
type: :development
|
89
70
|
version_requirements: *id005
|
90
71
|
- !ruby/object:Gem::Dependency
|
@@ -95,10 +76,7 @@ dependencies:
|
|
95
76
|
requirements:
|
96
77
|
- - ~>
|
97
78
|
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
- 0
|
100
|
-
- 6
|
101
|
-
version: "0.6"
|
79
|
+
version: 0.6.5
|
102
80
|
type: :development
|
103
81
|
version_requirements: *id006
|
104
82
|
- !ruby/object:Gem::Dependency
|
@@ -109,17 +87,47 @@ dependencies:
|
|
109
87
|
requirements:
|
110
88
|
- - ~>
|
111
89
|
- !ruby/object:Gem::Version
|
112
|
-
|
113
|
-
- 4
|
114
|
-
- 2
|
115
|
-
version: "4.2"
|
90
|
+
version: 4.2.7
|
116
91
|
type: :development
|
117
92
|
version_requirements: *id007
|
118
|
-
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: guard-rspec
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.2.0
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: rb-fsevent
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ~>
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 0.4.0
|
113
|
+
type: :development
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: growl
|
117
|
+
prerelease: false
|
118
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ~>
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.0.3
|
124
|
+
type: :development
|
125
|
+
version_requirements: *id010
|
126
|
+
description: Adds language translation methods to strings and arrays, backed by the Google Translate API
|
119
127
|
email:
|
120
128
|
- jimmy@jimmycuadra.com
|
121
|
-
executables:
|
122
|
-
|
129
|
+
executables:
|
130
|
+
- to_lang
|
123
131
|
extensions: []
|
124
132
|
|
125
133
|
extra_rdoc_files: []
|
@@ -128,17 +136,19 @@ files:
|
|
128
136
|
- .gitignore
|
129
137
|
- .yardopts
|
130
138
|
- Gemfile
|
139
|
+
- Guardfile
|
131
140
|
- LICENSE
|
132
141
|
- README.textile
|
133
142
|
- Rakefile
|
143
|
+
- bin/to_lang
|
134
144
|
- lib/to_lang.rb
|
135
145
|
- lib/to_lang/codemap.rb
|
136
146
|
- lib/to_lang/connector.rb
|
137
|
-
- lib/to_lang/
|
147
|
+
- lib/to_lang/translatable.rb
|
138
148
|
- lib/to_lang/version.rb
|
139
149
|
- spec/spec_helper.rb
|
140
150
|
- spec/to_lang/connector_spec.rb
|
141
|
-
- spec/to_lang/
|
151
|
+
- spec/to_lang/translatable_spec.rb
|
142
152
|
- spec/to_lang_spec.rb
|
143
153
|
- to_lang.gemspec
|
144
154
|
has_rdoc: true
|
@@ -155,26 +165,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
155
165
|
requirements:
|
156
166
|
- - ">="
|
157
167
|
- !ruby/object:Gem::Version
|
158
|
-
segments:
|
159
|
-
- 0
|
160
168
|
version: "0"
|
161
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
170
|
none: false
|
163
171
|
requirements:
|
164
172
|
- - ">="
|
165
173
|
- !ruby/object:Gem::Version
|
166
|
-
segments:
|
167
|
-
- 0
|
168
174
|
version: "0"
|
169
175
|
requirements: []
|
170
176
|
|
171
177
|
rubyforge_project: to_lang
|
172
|
-
rubygems_version: 1.
|
178
|
+
rubygems_version: 1.6.0
|
173
179
|
signing_key:
|
174
180
|
specification_version: 3
|
175
|
-
summary:
|
181
|
+
summary: Translate strings with Google Translate
|
176
182
|
test_files:
|
177
183
|
- spec/spec_helper.rb
|
178
184
|
- spec/to_lang/connector_spec.rb
|
179
|
-
- spec/to_lang/
|
185
|
+
- spec/to_lang/translatable_spec.rb
|
180
186
|
- spec/to_lang_spec.rb
|