Module: I18nData::LiveDataProvider

Extended by:
LiveDataProvider
Included in:
LiveDataProvider
Defined in:
lib/i18n_data/live_data_provider.rb

Overview

fetches data online from debian git

Constant Summary collapse

JSON_CODES =
{
  countries: 'data/iso_3166-1.json',
  languages: 'data/iso_639-2.json'
}.freeze
TRANSLATIONS =
{
  countries: 'iso_3166-1/',
  languages: 'iso_639-2/'
}.freeze
REPO =
"https://salsa.debian.org/iso-codes-team/iso-codes.git"
CLONE_DEST =
"/tmp/i18n_data_iso_clone"

Instance Method Summary collapse

Instance Method Details

#clear_cacheObject



33
34
35
36
# File 'lib/i18n_data/live_data_provider.rb', line 33

def clear_cache
  `rm -rf #{CLONE_DEST}`
  raise unless $?.success?
end

#codes(type, language_code) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/i18n_data/live_data_provider.rb', line 22

def codes(type, language_code)
  ensure_checkout

  language_code = language_code.upcase
  if language_code == 'EN'
    send("english_#{type}")
  else
    translated(type, language_code)
  end
end