Sha256: 10c67688eeeddb1b39e872b7a4aadc9f2bdffa8f1792766809fb089072be5417
Contents?: true
Size: 667 Bytes
Versions: 54
Compression:
Stored size: 667 Bytes
Contents
module UiBibz::Utils class Internationalization def initialize translation, options = {} @translation = translation @options = options end def translate I18n.t(@translation, options_with_default) end private def options_with_default @options[:default] = translate_default unless @options[:default].nil? @options end # To know if translation missing def i18n_set? key I18n.t key, :raise => true rescue false end def translate_default I18n.t([*@options[:default]].select{ |translation| i18n_set? translation }.first, default: [*@options[:default]].last) end end end
Version data entries
54 entries across 54 versions & 1 rubygems