lib/telegram/bot/updates_controller/translation.rb in telegram-bot-0.15.2 vs lib/telegram/bot/updates_controller/translation.rb in telegram-bot-0.15.3
- old
+ new
@@ -10,26 +10,26 @@
module Translation
extend ActiveSupport::Concern
module ClassMethods
# Class-level helper for lazy translations.
- def translate(key, options = {})
+ def translate(key, **options)
key = "#{controller_path.tr('/', '.')}#{key}" if key.to_s.start_with?('.')
- I18n.translate(key, options)
+ I18n.translate(key, **options)
end
alias :t :translate
end
# See toplevel description.
- def translate(key, options = {})
+ def translate(key, **options)
if key.to_s.start_with?('.')
path = controller_path.tr('/', '.')
defaults = [:"#{path}#{key}"]
defaults << options[:default] if options[:default]
options[:default] = defaults.flatten
key = "#{path}.#{action_name_i18n_key}#{key}"
end
- I18n.translate(key, options)
+ I18n.translate(key, **options)
end
alias :t :translate
# Strips trailing `!` from action_name.
def action_name_i18n_key