Module: SunDawg::LanguageIsoTranslater

Defined in:
lib/language_iso_translater.rb

Defined Under Namespace

Classes: NoLanguageError

Constant Summary collapse

FILE =

allows client application to override YAML hash

File.expand_path(File.join(File.dirname(__FILE__), 'languages.yml'))
LANGUAGES =
YAML.load_file(FILE)

Class Method Summary collapse

Class Method Details

.get_iso_639_1_translation(code) ⇒ Object

O(1) fetch of language properties given the ISO_639_1 2-letter code

Raises:



13
14
15
16
# File 'lib/language_iso_translater.rb', line 13

def self.get_iso_639_1_translation(code)
  raise NoLanguageError.new("[#{code}] IS NOT VALID") if LANGUAGES[code].nil?
  LANGUAGES[code]
end