Sha256: 16faf89ecbb10aff7ffd5bb2ce1c3313a24b6b1b5d38f4a81eda25645338b66d
Contents?: true
Size: 848 Bytes
Versions: 2
Compression:
Stored size: 848 Bytes
Contents
# encoding: utf-8 module AdhearsionI18n::CallControllerMethods def t(key, options = {}) this_locale = options[:locale] || locale options = {default: '', locale: locale}.merge(options) prompt = ::I18n.t "#{key}.audio", options text = ::I18n.t "#{key}.text", options if prompt.empty? && text.empty? # Look for a translation key that doesn't follow the Adhearsion-I18n structure text = ::I18n.t key, options end unless prompt.empty? prompt = "#{Adhearsion.config.i18n.audio_path}/#{this_locale}/#{prompt}" end RubySpeech::SSML.draw language: this_locale do if prompt.empty? string text else audio(src: prompt) { string text } end end end def locale call[:locale] || I18n.default_locale end def locale=(l) call[:locale] = l end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-i18n-1.0.1 | lib/adhearsion-i18n/call_controller_methods.rb |
adhearsion-i18n-1.0.0 | lib/adhearsion-i18n/call_controller_methods.rb |