Module: QDA::GUI::Lang

Defined in:
lib/weft/wxgui/lang.rb,
lib/weft/wxgui/lang/en.rb

Defined Under Namespace

Modules: En

Class Method Summary collapse

Class Method Details

.set_language(lang_code) ⇒ Object

lang_code = ‘En’



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/weft/wxgui/lang.rb', line 4

def Lang.set_language(lang_code)
  begin
    require "weft/wxgui/lang/#{lang_code.downcase}"
  rescue LoadError
    raise LoadError, "No language file for language '#{lang_code}'"
  end
  language = QDA::GUI::Lang.const_get(lang_code)
  language.constants.each do | interface_element |
    translation = language::const_get(interface_element)
    const_set( interface_element, translation )
  end
end