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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 889e9057b51d7f7a452c0671d2ba1f0c07b5ee1c
4
- data.tar.gz: 8438d71814f98417f05995c63028a575399c22c8
3
+ metadata.gz: ccc237aee111def6d35f498e4521e9129ad18f1f
4
+ data.tar.gz: c6ab36c8cd34051d016cb2ce7f4443e66e7d74e2
5
5
  SHA512:
6
- metadata.gz: 77769d154e80f367662a70d437e333599eafee7d9646bf3a268e333caf0ada75a40f6b39a6b3ea97b5b009435bc3fb33266f14d29d7120c4092f4092c202f78b
7
- data.tar.gz: 3dc19abfb547acfec075d3f75eae1dea0b46f59fbd18e70f96dbfc70b4966403e0014779954aaf5ac5d39d8c97fd6745e0d74873fa0189f290ce1720110e6537
6
+ metadata.gz: 53adabd5369821b99f39ed2df4dd018631610b8091123785b8bdff71fef6376642f4dd733e9896261acd9206c2eec5a0e49570caa7d50ef2cc2c0eedf94a628d
7
+ data.tar.gz: 182506d3b0e7348039bc4bbf7ad735ab5bb4d2292997cd7c0894442a6c63b3d2ef9b061b07e39c37d01b1d39863f500c774462136dccb9475fd4df71e537a5a5
@@ -1,5 +1,8 @@
1
1
  # develop
2
2
 
3
+ # v1.1.0
4
+ * [FEATURE] Add fallback config option to disable text fallback when audio prompts exist.
5
+
3
6
  # v1.0.1
4
7
  * Permit any 0.x version of i18n, particularly 0.7.0
5
8
 
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require 'bundler/gem_tasks'
4
+
3
5
  require 'rspec/core/rake_task'
4
6
 
5
7
  RSpec::Core::RakeTask.new :spec
@@ -20,7 +20,11 @@ module AdhearsionI18n::CallControllerMethods
20
20
  if prompt.empty?
21
21
  string text
22
22
  else
23
- audio(src: prompt) { string text }
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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class AdhearsionI18n
4
- VERSION = '1.0.1'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -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.1
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-25 00:00:00.000000000 Z
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: