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.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/zlocalize/config.rb', line 10

def initialize
  @return_source_on_missing = { :development => true, :test => false, :production => false, :staging => false }
  @harvest_paths = [
    "app/channels/**/*.rb",
    "app/controllers/**/*.rb",
    "app/helpers/**/*.rb",
    "app/models/**/*.rb",
    "app/views/**/*.erb",
    "app/mailers/**/*.rb",
    "app/jobs/**/*.rb",
    "lib/**/*.rb"
  ]
  @locales = {}
  @use_global_gettext_methods = true
end

Instance Attribute Details

#define_gettext_methodsObject

Returns the value of attribute define_gettext_methods.



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

def define_gettext_methods
  @define_gettext_methods
end

#harvest_pathsObject (readonly)

Returns the value of attribute harvest_paths.



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

def harvest_paths
  @harvest_paths
end

#localesObject

Returns the value of attribute locales.



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

def locales
  @locales
end

#return_source_on_missingObject

Returns the value of attribute return_source_on_missing.



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

def return_source_on_missing
  @return_source_on_missing
end

Instance Method Details

#please_define_gettext_methodsObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/zlocalize/config.rb', line 45

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