Module: ChefApply::Text
- Defined in:
- lib/chef_apply/text.rb,
lib/chef_apply/text/text_wrapper.rb,
lib/chef_apply/text/error_translation.rb
Defined Under Namespace
Classes: ErrorTranslation, TextWrapper
Class Method Summary
collapse
Class Method Details
._error_table ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/chef_apply/text.rb', line 26
def self._error_table
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 ⇒ Object
34
35
36
|
# File 'lib/chef_apply/text.rb', line 34
def self._translation_path
@translation_path ||= File.join(File.dirname(__FILE__), "..", "..", "i18n")
end
|
.load ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# 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
|