Sha256: ed77c6d401d4665ad6d3fe9bb3cb4d9f94579b1d68ec453b4ce6158a2ceb7357

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb-localizer-0.1.0 lib/fb-localizer.rb