Class: HTranslate

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/hengine/htranslate.rb

Overview

require “hmisc/hconfiguration”

Instance Method Summary collapse

Constructor Details

#initializeHTranslate

Returns a new instance of HTranslate.



10
11
12
13
14
15
16
17
# 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

Instance Method Details

#tr(word) ⇒ Object



26
27
28
29
30
# File 'lib/hengine/htranslate.rb', line 26

def tr(word)

  return self.translate(word)

end

#translate(word) ⇒ Object



19
20
21
22
23
24
# File 'lib/hengine/htranslate.rb', line 19

def translate(word)

  wd = @dictionary[word]
  return (wd) ? wd : word

end