Sha256: 78388f17cebe839a658dfcb6f145bc46358480dd19318f0ad809696a268baf44

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

# -*- coding: utf-8 -*-
require 'jpmobile/lookup_context'

module ActionController
  class Base
    include Jpmobile::Helpers
    before_filter :gettext_force_ja_for_mobile
    # gettextが組み込まれている場合、携帯電話からのアクセスをjaロケールに強制する。
    def gettext_force_ja_for_mobile
      if Object.const_defined?(:GetText) and request.mobile?
        begin
          ::GetText.locale = 'ja'
        rescue NameError
        end
      end
    end
  end
end

ActionController::Request.send :include, Jpmobile::Encoding

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
jpmobile-1.0.0.pre.1 lib/jpmobile/hook_action_controller.rb
jpmobile-1.0.0.pre.1 test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb