Sha256: 26d1d0d20f7df75b7b77575804b5b40099cbcb14cbb13572a891588625a63052
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true require "i18n" require "active_support/core_ext/array/extract_options" ## # @see Archangel # module Archangel extend ActionView::Helpers::TranslationHelper extend ActionView::Helpers::TagHelper class << self ## # Translate # # Example # # config/locales/en.yml # en: # archangel: # hello: Hello # foo: # bar: Bar # # Archangel.translate(:hello) #=> "Hello" # Archangel.translate(:bar, scope: :foo) #=> "Bar" # Archangel.t(:hello) #=> "Hello" # Archangel.t(:bar, scope: :foo) #=> "Bar" # I18n.t(:hello, scope: :archangel) #=> "Hello" # I18n.translate(:hello, scope: :archangel) #=> "Hello" # # @param args [String,Array] translation parameters # @return [String] the translated string # def translate(*args) options = args.extract_options! options[:scope] = [*options[:scope]].unshift(:archangel) args << options super(*args) end alias t translate end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archangel-0.4.0 | lib/archangel/i18n.rb |