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'
}
TRANSLATIONS =
{
  :countries => 'iso_3166-1/',
  :languages => 'iso_639-2/'
}
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



31
32
33
34
# File 'lib/i18n_data/live_data_provider.rb', line 31

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

#codes(type, language_code) ⇒ Object



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

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