Sha256: 296ccbca9411d6063a27eac6bbd0f85797008db7f3e4b96e721b20e39dc83687
Contents?: true
Size: 446 Bytes
Versions: 5
Compression:
Stored size: 446 Bytes
Contents
# frozen_string_literal: true module Phlex module Translation def self.included(view) view.extend(ClassMethods) end module ClassMethods attr_writer :translation_path def translation_path @translation_path ||= name&.split("::")&.join(".")&.downcase.to_s end end def translate(key, **options) key = "#{self.class.translation_path}#{key}" if key.start_with?(".") ::I18n.translate(key, **options) end end end
Version data entries
5 entries across 5 versions & 2 rubygems