Class: ZLocalize::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/zlocalize/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
17
# File 'lib/zlocalize/config.rb', line 12

def initialize
  @reload_per_request = { :development => true, :test => false, :production => false, :staging => false }
  @return_source_on_missing = { :development => true, :test => false, :production => false, :staging => false }
  @locales = {}
  @use_global_gettext_methods = true
end

Instance Attribute Details

#define_gettext_methodsObject

Returns the value of attribute define_gettext_methods.



10
11
12
# File 'lib/zlocalize/config.rb', line 10

def define_gettext_methods
  @define_gettext_methods
end

#localesObject

Returns the value of attribute locales.



9
10
11
# File 'lib/zlocalize/config.rb', line 9

def locales
  @locales
end

#reload_per_requestObject

Returns the value of attribute reload_per_request.



6
7
8
# File 'lib/zlocalize/config.rb', line 6

def reload_per_request
  @reload_per_request
end

#return_source_on_missingObject

Returns the value of attribute return_source_on_missing.



7
8
9
# File 'lib/zlocalize/config.rb', line 7

def return_source_on_missing
  @return_source_on_missing
end

Instance Method Details

#please_define_gettext_methodsObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/zlocalize/config.rb', line 48

def please_define_gettext_methods
  Object.class_eval <<-EOV
     def _(key,options = {})
       ZLocalize.translate(key, options)
     end

     def n_(key,count,options = {})
       ZLocalize.pluralize(key,count,options)
     end
  EOV
end