adhearsion-i18n 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +62 -0
- data/adhearsion-i18n.gemspec +29 -0
- data/lib/adhearsion-i18n/call_controller_methods.rb +16 -0
- data/lib/adhearsion-i18n/plugin.rb +14 -0
- data/lib/adhearsion-i18n/version.rb +5 -0
- data/lib/adhearsion-i18n.rb +10 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e463ed4f0c550e8e75ab106657d90d26ddfc5d95
|
4
|
+
data.tar.gz: 8034854d0020472d7b6070a41207569bb70c0b74
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1cb66a73e434715ef5563cd5b0bf68bbdb4c44d899e860a7b0360188bd76ff72bea5bc8b062c41376b36c544bf50d1e6ed87a47e690f7a250cf75590c259dba
|
7
|
+
data.tar.gz: c953b0beeeaccafb39996919edb553cdc9ece394a4806bbc54a19224690882014100bd01db9d7d88003ad4568ad8c95c1daab7a9d9f246cc70102423123d5b52
|
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Gemfile.lock
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
coverage
|
7
|
+
InstalledFiles
|
8
|
+
lib/bundler/man
|
9
|
+
pkg
|
10
|
+
rdoc
|
11
|
+
spec/reports
|
12
|
+
test/tmp
|
13
|
+
test/version_tmp
|
14
|
+
tmp
|
15
|
+
|
16
|
+
# YARD artifacts
|
17
|
+
.yardoc
|
18
|
+
_yardoc
|
19
|
+
doc/
|
20
|
+
|
21
|
+
# Editor files
|
22
|
+
.*.sw*
|
23
|
+
*~
|
24
|
+
|
25
|
+
# OS Files
|
26
|
+
.DS_Store
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Adhearsion
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
adhearsion-i18n
|
2
|
+
===============
|
3
|
+
|
4
|
+
Internationalization for Adhearsion apps
|
5
|
+
|
6
|
+
## Installing
|
7
|
+
|
8
|
+
Simply add to your Gemfile like any other Adhearsion plugin:
|
9
|
+
|
10
|
+
```Ruby
|
11
|
+
gem 'adhearsion-i18n'
|
12
|
+
```
|
13
|
+
|
14
|
+
## Configuration
|
15
|
+
|
16
|
+
See `rake config:show` to see a full list of options.
|
17
|
+
|
18
|
+
Make sure to create your locales in `config/locales` within your Adhearsion app.
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
|
22
|
+
en.yml:
|
23
|
+
|
24
|
+
```yaml
|
25
|
+
en:
|
26
|
+
string1:
|
27
|
+
audio: /path/to/string1.wav
|
28
|
+
text: String One
|
29
|
+
|
30
|
+
string2:
|
31
|
+
audio: /path/to/string2.wav
|
32
|
+
|
33
|
+
string3:
|
34
|
+
text: String Three
|
35
|
+
```
|
36
|
+
|
37
|
+
example_controller.rb:
|
38
|
+
|
39
|
+
```Ruby
|
40
|
+
class ExampleController < Adhearsion::CallController
|
41
|
+
def run
|
42
|
+
answer
|
43
|
+
|
44
|
+
play t(:string1)
|
45
|
+
# SSML generated: <speak><audio src="/path/to/string1.wav">String One</audio></speak>
|
46
|
+
|
47
|
+
play t(:string2)
|
48
|
+
# SSML generated: <speak><audio src="/path/to/string2.wav"></audio></speak>
|
49
|
+
|
50
|
+
play t(:string3)
|
51
|
+
# SSML generated: <speak>String Three</speak>
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
## Credits
|
57
|
+
|
58
|
+
Copyright (C) 2014 The Adhearsion Foundation
|
59
|
+
|
60
|
+
adhearsion-i18n is released under the [MIT license](http://opensource.org/licenses/MIT). Please see the [LICENSE](https://github.com/bklang/sippy_cup/blob/master/LICENSE) file for details.
|
61
|
+
|
62
|
+
adhearsion-i18n was created by [Ben Klang](https://twitter.com/bklang) with support from [Mojo Lingo](https://mojolingo.com) and their clients.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "adhearsion-i18n/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "adhearsion-i18n"
|
7
|
+
s.version = AdhearsionI18n::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Ben Klang", "Justin Aiken"]
|
10
|
+
s.email = "dev@adhearsion.com"
|
11
|
+
s.homepage = "http://adhearsion.com"
|
12
|
+
s.summary = "Internationalization helpers for Adhearsion applications"
|
13
|
+
s.description = "This provides helpers that manage internationalized audio prompts, both file-based and text-based"
|
14
|
+
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
s.required_ruby_version = '>= 1.9.3'
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.add_runtime_dependency 'activesupport', [">= 3.0.0", "< 5.0.0"]
|
25
|
+
s.add_runtime_dependency 'adhearsion', ["~> 2.0"]
|
26
|
+
s.add_runtime_dependency 'i18n', ["~> 0.6"]
|
27
|
+
|
28
|
+
s.add_development_dependency 'rspec', ["~> 2.11"]
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module AdhearsionI18n::CallControllerMethods
|
4
|
+
def t(key)
|
5
|
+
prompt = ::I18n.t "#{key.to_s}.audio", default: ''
|
6
|
+
text = ::I18n.t "#{key.to_s}.text"
|
7
|
+
|
8
|
+
RubySpeech::SSML.draw do
|
9
|
+
if prompt.empty?
|
10
|
+
string text
|
11
|
+
else
|
12
|
+
audio(src: prompt) { string text }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class AdhearsionI18n::Plugin < Adhearsion::Plugin
|
4
|
+
init :i18n do
|
5
|
+
::Adhearsion::CallController.mixin ::Adhearsion::I18n::CallControllerMethods
|
6
|
+
logger.info "Adhearsion I18n loaded"
|
7
|
+
end
|
8
|
+
|
9
|
+
config :i18n do
|
10
|
+
locale_path ["#{Adhearsion.root}/config/locales"], transform: Proc.new { |v| v.split ':' }, desc: <<-__
|
11
|
+
List of directories from which to load locale data, colon-delimited
|
12
|
+
__
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adhearsion-i18n
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Klang
|
8
|
+
- Justin Aiken
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 3.0.0
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 5.0.0
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.0.0
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.0.0
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: adhearsion
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: i18n
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.6'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.11'
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.11'
|
76
|
+
description: This provides helpers that manage internationalized audio prompts, both
|
77
|
+
file-based and text-based
|
78
|
+
email: dev@adhearsion.com
|
79
|
+
executables: []
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- ".gitignore"
|
84
|
+
- Gemfile
|
85
|
+
- LICENSE
|
86
|
+
- README.md
|
87
|
+
- adhearsion-i18n.gemspec
|
88
|
+
- lib/adhearsion-i18n.rb
|
89
|
+
- lib/adhearsion-i18n/call_controller_methods.rb
|
90
|
+
- lib/adhearsion-i18n/plugin.rb
|
91
|
+
- lib/adhearsion-i18n/version.rb
|
92
|
+
homepage: http://adhearsion.com
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.9.3
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.1
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Internationalization helpers for Adhearsion applications
|
116
|
+
test_files: []
|
117
|
+
has_rdoc:
|