Sha256: ebd05dec65f78d289e3dfd6ad88a9a541ae3cecc7eb7796c8a5f673645be7f75

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

# -*- coding: utf-8 -*-
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
ActionView::LookupContext.register_detail(:mobile) {nil}

Version data entries

2 entries across 1 versions & 1 rubygems

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