Module: I18nAdminUtils::Config

Defined in:
lib/i18n_admin_utils/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.localesObject

Returns the value of attribute locales.



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

def locales
  @locales
end

.reload_translation_after_updateObject

Returns the value of attribute reload_translation_after_update.



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

def reload_translation_after_update
  @reload_translation_after_update
end

.search_foldersObject

Returns the value of attribute search_folders.



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

def search_folders
  @search_folders
end

.search_folders_excludeObject

Returns the value of attribute search_folders_exclude.



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

def search_folders_exclude
  @search_folders_exclude
end

.translation_modelObject

Returns the value of attribute translation_model.



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

def translation_model
  @translation_model
end

.yml_fileObject

Returns the value of attribute yml_file.



11
12
13
# File 'lib/i18n_admin_utils/config.rb', line 11

def yml_file
  @yml_file
end

Class Method Details

.backendObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/i18n_admin_utils/config.rb', line 42

def backend
  if @backend.nil? or @backend.blank?
    i18n_backend = I18n.backend.class.to_s
    if i18n_backend == 'I18n::Backend::Chain' #If the backend is a chain but no backend was specified then we take the first one
      i18n_backend = I18n.backend.backends.first.class.to_s
    end
    self.backend=i18n_backend
  end
  @backend
end

.backend=(i18n_backend) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/i18n_admin_utils/config.rb', line 32

def backend=(i18n_backend)
  if i18n_backend.to_s == 'I18n::Backend::ActiveRecord'
    @backend = I18nAdminUtils::Backend::ActiveRecordManager
  elsif i18n_backend.to_s == 'I18n::Backend::Simple'
    @backend = I18nAdminUtils::Backend::YmlManager
  else
    raise Exception, "I18nAdminUtils, backend #{i18n_backend} not supported!"
  end
end

.resetObject



13
14
15
16
17
18
19
20
21
# File 'lib/i18n_admin_utils/config.rb', line 13

def reset
  @translation_model = 'Translation'
  @reload_translation_after_update = true
  @locales = ['en']
  @search_folders = ["#{Rails.root}/app"]
  @search_folders_exclude = []
  @yml_file = ''
  @backend = nil
end