Class: Kommandant::Command
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Kommandant::Command
- Includes:
- MeiliSearch::Rails
- Defined in:
- app/models/kommandant/command.rb
Instance Method Summary collapse
Instance Method Details
#name ⇒ Object
9 10 11 12 13 |
# File 'app/models/kommandant/command.rb', line 9 def name return "no translation for #{I18n.locale}.name in Meilisearch" unless translator.exists?(I18n.locale, "name") translator.translate(I18n.locale, "name") end |
#placeholder ⇒ Object
15 16 17 18 19 |
# File 'app/models/kommandant/command.rb', line 15 def placeholder return unless translator.exists?(I18n.locale, "placeholder") translator.translate(I18n.locale, "placeholder") end |
#translator ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/models/kommandant/command.rb', line 21 def translator @translator ||= begin translator = I18n::Backend::KeyValue.new({}) translations&.each_pair do |locale, data| translator.store_translations(locale, data) end translator end end |