class Sinamak::Polyglot
Public Class Methods
new()
click to toggle source
# File lib/sinamak/polyglot.rb, line 5 def initialize @translation_source = TranslationSource.new if CONNECTION end
Public Instance Methods
available_languages()
click to toggle source
# File lib/sinamak/polyglot.rb, line 9 def available_languages translation_source.supported_languages end
detect_language(text)
click to toggle source
# File lib/sinamak/polyglot.rb, line 13 def detect_language(text) translation_source.detect_language(text) end
translate(text, from: 'en', to:)
click to toggle source
# File lib/sinamak/polyglot.rb, line 17 def translate(text, from: 'en', to:) translation_source.translate(text, from: from, to: to) end
Private Instance Methods
translation_source()
click to toggle source
# File lib/sinamak/polyglot.rb, line 23 def translation_source @translation_source || NoopTranslationSource.new end