class HTranslate
require “hmisc/hconfiguration”
Public Class Methods
new()
click to toggle source
# File lib/hengine/htranslate.rb, line 10 def initialize() #p I18n.t("hello") language = HConfiguration.instance().value("language") @dictionary = YAML.load_file("config/locales/#{language}.yml")[language] end
Public Instance Methods
tr(word)
click to toggle source
# File lib/hengine/htranslate.rb, line 26 def tr(word) return self.translate(word) end
translate(word)
click to toggle source
# File lib/hengine/htranslate.rb, line 19 def translate(word) wd = @dictionary[word] return (wd) ? wd : word end