Class: ReVIEW::I18n
Class Method Summary collapse
Class Method Details
.i18n(locale, user_i18n = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/review/i18n.rb', line 13 def self.i18n(locale, user_i18n = {}) locale ||= "ja" i18n_yaml_path = File. "i18n.yaml", File.dirname(__FILE__) @i18n = YAML.load_file(i18n_yaml_path)[locale] if @i18n @i18n.merge!(user_i18n) end end |
.setup ⇒ Object
6 7 8 9 10 11 |
# File 'lib/review/i18n.rb', line 6 def self.setup user_i18n = YAML.load_file(File. "locale.yaml", ENV["PWD"]) I18n.i18n user_i18n["locale"], user_i18n rescue I18n.i18n "ja" end |
.t(str, args = nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/review/i18n.rb', line 22 def self.t(str, args = nil) @i18n[str] % args rescue str end |