Module: I18nData::FileDataProvider

Extended by:
FileDataProvider
Included in:
FileDataProvider
Defined in:
lib/i18n_data/file_data_provider.rb

Constant Summary collapse

DATA_SEPERATOR =
";;"

Instance Method Summary collapse

Instance Method Details

#codes(type, language_code) ⇒ Object



6
7
8
9
10
11
# File 'lib/i18n_data/file_data_provider.rb', line 6

def codes(type,language_code)
  unless data = read_from_file(type,language_code)
    raise NoTranslationAvailable.new("#{type}-#{language_code}")
  end
  data
end

#write_cache(provider) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/i18n_data/file_data_provider.rb', line 13

def write_cache(provider)
  languages = provider.codes(:languages,'EN').keys
  languages.each{|language_code|
    [:languages,:countries].each {|type|
      begin
        data = provider.send(:codes,type,language_code)
        write_to_file(data,type,language_code)
      rescue NoTranslationAvailable
      end
    }
  }
end