Class: GyomuRuby::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/gyomu_ruby/translated_from.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale = I18n.locale) ⇒ Translation

Returns a new instance of Translation.



9
10
11
# File 'lib/gyomu_ruby/translated_from.rb', line 9

def initialize(locale = I18n.locale)
  @locale = locale
end

Class Method Details

.source(word, scope) ⇒ Object



5
6
7
# File 'lib/gyomu_ruby/translated_from.rb', line 5

def self.source(word, scope)
  new('ja').source(word, scope)
end

Instance Method Details

#source(word, scope) ⇒ Object



13
14
15
# File 'lib/gyomu_ruby/translated_from.rb', line 13

def source(word, scope)
  I18n.t!(scope, locale: @locale).key(word.to_s).try(:to_s)
end