Module: Frank::Cucumber::Localize
- Defined in:
- lib/frank-cucumber/frank_localize.rb
Class Method Summary collapse
Class Method Details
.load_translations ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/frank-cucumber/frank_localize.rb', line 28 def self.load_translations if I18n.backend.send(:translations).size == 0 I18n.locale = self.system_locale I18n.load_path = [ File.join(File.dirname(__FILE__), 'localize.yml') ] I18n.backend.load_translations end end |
.system_locale ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/frank-cucumber/frank_localize.rb', line 7 def self.system_locale case ENV['LANG'] when /^fr_/ :fr when /^de_/ :de when /^ru_/ :ru when /^zh_/ :zh when /^ja_/ :ja when /^es_/ :es when /^it_/ :it else :en end end |
.t(key) ⇒ Object
36 37 38 39 |
# File 'lib/frank-cucumber/frank_localize.rb', line 36 def self.t(key) self.load_translations I18n.t(key) end |