Class: AbstractController::I18nProxy

Inherits:
I18n::Config
  • Object
show all
Defined in:
actionpack/lib/abstract_controller/rendering.rb

Overview

This is a class to fix I18n global state. Whenever you provide I18n.locale during a request, it will trigger the lookup_context and consequently expire the cache. TODO Add some deprecation warnings to remove I18n.locale from controllers

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (I18nProxy) initialize(i18n_config, lookup_context)

A new instance of I18nProxy



19
20
21
# File 'actionpack/lib/abstract_controller/rendering.rb', line 19

def initialize(i18n_config, lookup_context)
  @i18n_config, @lookup_context = i18n_config, lookup_context
end

Instance Attribute Details

- (Object) i18n_config (readonly)

:nodoc:



17
18
19
# File 'actionpack/lib/abstract_controller/rendering.rb', line 17

def i18n_config
  @i18n_config
end

- (Object) lookup_context (readonly)

:nodoc:



17
18
19
# File 'actionpack/lib/abstract_controller/rendering.rb', line 17

def lookup_context
  @lookup_context
end

Instance Method Details

- (Object) locale



23
24
25
# File 'actionpack/lib/abstract_controller/rendering.rb', line 23

def locale
  @i18n_config.locale
end

- (Object) locale=(value)



27
28
29
# File 'actionpack/lib/abstract_controller/rendering.rb', line 27

def locale=(value)
  @lookup_context.locale = value
end