module ChefApply::Text
Public Class Methods
_error_table()
click to toggle source
# File lib/chef_apply/text.rb, line 26 def self._error_table # Though ther may be several translations, en.yml will be the only one with # error metadata. path = File.join(_translation_path, "errors", "en.yml") raw_yaml = File.read(path) @error_table ||= YAML.load(raw_yaml, _translation_path, symbolize_names: true)[:errors] end
_translation_path()
click to toggle source
# File lib/chef_apply/text.rb, line 34 def self._translation_path @translation_path ||= File.join(File.dirname(__FILE__), "..", "..", "i18n") end
load()
click to toggle source
# File lib/chef_apply/text.rb, line 38 def self.load R18n.from_env(Text._translation_path) R18n.extension_places << File.join(Text._translation_path, "errors") t = R18n.get.t t.translation_keys.each do |k| k = k.to_sym define_singleton_method k do |*args| TextWrapper.new(t.send(k, *args)) end end end