habluhablu 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/config/locales/es.yml +2 -0
- data/lib/habluhablu/version.rb +1 -1
- data/lib/translation.rb +7 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eb7be9baf82d77daac09b933e1307d67a2d84e9a28ddc71779c6c2a719a0bd9
|
4
|
+
data.tar.gz: 7c618006ba9ee8784378dd1fa5560ee2f22c18a207cabc1abf48d5729479ca43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103bc857b0d829c13561efd325fb9babe8a418970d2f45d6c320bbd04d5d26076db230ebbd80579d6b6fd1f5b52fd154aabeede2987d7e2cdb91a35cd25c4e75
|
7
|
+
data.tar.gz: fd84e12afac9ac8e4169117befa1f497565fbad9862a41d53037230462c4c87dcfef2462a621ef6b9ceb05eff386506305106987be381fefb0a222ef5a715ef2
|
data/Gemfile.lock
CHANGED
data/lib/habluhablu/version.rb
CHANGED
data/lib/translation.rb
CHANGED
@@ -25,7 +25,7 @@ class Translation
|
|
25
25
|
$KEY = f.read
|
26
26
|
end
|
27
27
|
if $KEY.length <= 2 || $KEY.nil?
|
28
|
-
@request["x-rapidapi-key"] = '
|
28
|
+
@request["x-rapidapi-key"] = 'ef9f61b3d0mshb95dcad44627e7cp176d4bjsn8f4d9e2a1706'
|
29
29
|
else
|
30
30
|
@request["x-rapidapi-key"] = $KEY
|
31
31
|
end
|
@@ -36,9 +36,13 @@ class Translation
|
|
36
36
|
|
37
37
|
def response
|
38
38
|
response = @http.request(@request)
|
39
|
-
content = JSON.parse(response.read_body)
|
39
|
+
content = JSON.parse(response.read_body)
|
40
|
+
content = content["data"]["translations"].first["translatedText"]
|
40
41
|
File.open("config/locales/#{@target}.yml", "a+") do |f|
|
41
|
-
f.write({ "
|
42
|
+
f.write({ "translation" => content.to_s }.to_yaml)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
46
|
+
|
47
|
+
tr = Translation.new("Hi_there", "es")
|
48
|
+
tr.response
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: habluhablu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Gramatowski
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- bin/setup
|
34
34
|
- config/api_key.txt
|
35
35
|
- config/locales/api_key.txt
|
36
|
+
- config/locales/es.yml
|
36
37
|
- config/locales/iw.yml
|
37
38
|
- exe/habluhablu
|
38
39
|
- habluhablu.gemspec
|