adhearsion-i18n 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Rakefile +2 -0
- data/lib/adhearsion-i18n/call_controller_methods.rb +5 -1
- data/lib/adhearsion-i18n/plugin.rb +3 -0
- data/lib/adhearsion-i18n/version.rb +1 -1
- data/spec/call_controller_methods_spec.rb +28 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccc237aee111def6d35f498e4521e9129ad18f1f
|
4
|
+
data.tar.gz: c6ab36c8cd34051d016cb2ce7f4443e66e7d74e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53adabd5369821b99f39ed2df4dd018631610b8091123785b8bdff71fef6376642f4dd733e9896261acd9206c2eec5a0e49570caa7d50ef2cc2c0eedf94a628d
|
7
|
+
data.tar.gz: 182506d3b0e7348039bc4bbf7ad735ab5bb4d2292997cd7c0894442a6c63b3d2ef9b061b07e39c37d01b1d39863f500c774462136dccb9475fd4df71e537a5a5
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -20,7 +20,11 @@ module AdhearsionI18n::CallControllerMethods
|
|
20
20
|
if prompt.empty?
|
21
21
|
string text
|
22
22
|
else
|
23
|
-
|
23
|
+
if Adhearsion.config.i18n.fallback
|
24
|
+
audio(src: prompt) { string text }
|
25
|
+
else
|
26
|
+
audio(src: prompt)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -20,6 +20,9 @@ class AdhearsionI18n::Plugin < Adhearsion::Plugin
|
|
20
20
|
audio_path "file://#{Adhearsion.root}/audio", desc: <<-__
|
21
21
|
Base path from which audio files can be found. May be a filesystem path or some other URL (like HTTP)
|
22
22
|
__
|
23
|
+
fallback true, desc: <<-__
|
24
|
+
Whether to include text for translations that provide both text & audio. True or false.
|
25
|
+
__
|
23
26
|
end
|
24
27
|
|
25
28
|
tasks do
|
@@ -88,4 +88,32 @@ describe AdhearsionI18n::CallControllerMethods do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
+
|
92
|
+
describe 'with fallback disabled, requesting a translation' do
|
93
|
+
before do
|
94
|
+
Adhearsion.config.i18n.fallback = false
|
95
|
+
Adhearsion::Plugin.init_plugins
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should generate proper SSML with only audio (no text) translations' do
|
99
|
+
ssml = controller.t :my_shirt_is_white
|
100
|
+
ssml.should == RubySpeech::SSML.draw(language: 'en') do
|
101
|
+
audio src: "file:///audio/en/my_shirt_is_white.wav"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should generate proper SSML with only text (no audio) translations' do
|
106
|
+
ssml = controller.t :many_people_out_today
|
107
|
+
ssml.should == RubySpeech::SSML.draw(language: 'en') do
|
108
|
+
string 'There are many people out today'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should generate proper SSML with only audio translations when both are supplied' do
|
113
|
+
ssml = controller.t :have_many_cats
|
114
|
+
ssml.should == RubySpeech::SSML.draw(language: 'en') do
|
115
|
+
audio src: "file:///audio/en/have_many_cats.wav"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
91
119
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhearsion-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Klang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -125,4 +125,3 @@ test_files:
|
|
125
125
|
- spec/fixtures/locale/en.yml
|
126
126
|
- spec/fixtures/locale/it.yml
|
127
127
|
- spec/spec_helper.rb
|
128
|
-
has_rdoc:
|