Sha256: e3bc07a72547f8bc4a2173ae0c057234542c9c19f9c30bae4efe5be0ab91a8f3

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

require 'fb-localizer/railtie' if defined? Rails
require 'i18n'

module FbLocalizer
  module FbLocalizerHelpers
    def get_fb_locale(ruby_locale = nil)
      ruby_locale ||= I18n.locale
      fb_candidate_locales = FbLocalizer::FbLocalizerHelpers::FB_LOCALES.select{ |l| l.match(/^#{ruby_locale}/)}
      if fb_candidate_locales.any?
        fb_candidate_locales[0]
      else
        "en_US"
      end
    end
  end
end

ActionView::Base.send(:include, FbLocalizer::FbLocalizerHelpers)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fb-localizer-0.1.2 lib/fb-localizer.rb
fb-localizer-0.1.1 lib/fb-localizer.rb