Module: I18nData
- Defined in:
- lib/i18n_data.rb,
lib/i18n_data/version.rb,
lib/i18n_data/file_data_provider.rb,
lib/i18n_data/live_data_provider.rb
Defined Under Namespace
Modules: FileDataProvider, LiveDataProvider
Classes: AccessDenied, BaseException, NoTranslationAvailable, Unknown
Constant Summary
collapse
- VERSION =
rubocop:disable Naming/ConstantName
Version = "1.1.0"
Class Method Summary
collapse
Class Method Details
.countries(language_code = 'EN') ⇒ Object
22
23
24
25
26
|
# File 'lib/i18n_data.rb', line 22
def countries(language_code = 'EN')
fetch :countries, language_code do
data_provider.codes(:countries, normal_to_region_code(language_code.to_s.upcase))
end
end
|
.country_code(name) ⇒ Object
28
29
30
|
# File 'lib/i18n_data.rb', line 28
def country_code(name)
recognise_code(:countries, name)
end
|
.data_provider ⇒ Object
36
37
38
39
40
41
|
# File 'lib/i18n_data.rb', line 36
def data_provider
@data_provider ||= begin
require 'i18n_data/file_data_provider'
FileDataProvider
end
end
|
.data_provider=(provider) ⇒ Object
43
44
45
46
|
# File 'lib/i18n_data.rb', line 43
def data_provider=(provider)
@cache = nil
@data_provider = provider
end
|
.language_code(name) ⇒ Object
32
33
34
|
# File 'lib/i18n_data.rb', line 32
def language_code(name)
recognise_code(:languages, name)
end
|
.languages(language_code = 'EN') ⇒ Object
16
17
18
19
20
|
# File 'lib/i18n_data.rb', line 16
def languages(language_code = 'EN')
fetch :languages, language_code do
data_provider.codes(:languages, normal_to_region_code(language_code.to_s.upcase))
end
end
|