Class: EasyInstaller::Translate
- Inherits:
-
Object
- Object
- EasyInstaller::Translate
- Defined in:
- lib/easy_installer/translate.rb
Class Attribute Summary collapse
-
.translation_file_path ⇒ Object
Returns the value of attribute translation_file_path.
Class Method Summary collapse
-
.app(type) ⇒ Object
Returns translated info about application ==== Attributes *
type
- String or Symbol: value ====Example app(:info1) app(“info2”). -
.input(name, type) ⇒ Object
Returns translated input ==== Attributes *
name
- String: name of input *type
- String or Symbol: Type of value ====Example input(“path”, :name) input(“path”, :description). -
.method(name, type) ⇒ Object
Returns translated method ==== Attributes *
name
- String: name of input *type
- String or Symbol: Type of value ====Example method(“ftp”, :title) method(“local”, :description). -
.set_location(location) ⇒ Object
Sets location ==== Attributes *
location
- String: 2 char representation of location ==== Example set_location(“pl”).
Class Attribute Details
.translation_file_path ⇒ Object
Returns the value of attribute translation_file_path.
7 8 9 |
# File 'lib/easy_installer/translate.rb', line 7 def translation_file_path @translation_file_path end |
Class Method Details
.app(type) ⇒ Object
Returns translated info about application
Attributes
-
type
- String or Symbol: value
Example
app(:info1) app(“info2”)
61 62 63 64 65 66 67 |
# File 'lib/easy_installer/translate.rb', line 61 def self.app(type) begin @@translator["app"][type.to_s] rescue type.to_S end end |
.input(name, type) ⇒ Object
Returns translated input
Attributes
-
name
- String: name of input -
type
- String or Symbol: Type of value
Example
input(“path”, :name) input(“path”, :description)
32 33 34 35 36 37 38 |
# File 'lib/easy_installer/translate.rb', line 32 def self.input(name, type) begin @@translator["input"][name.to_s][type.to_s] rescue name end end |
.method(name, type) ⇒ Object
Returns translated method
Attributes
-
name
- String: name of input -
type
- String or Symbol: Type of value
Example
method(“ftp”, :title) method(“local”, :description)
47 48 49 50 51 52 53 |
# File 'lib/easy_installer/translate.rb', line 47 def self.method(name, type) begin @@translator["method"][name.to_s][type.to_s] rescue name end end |
.set_location(location) ⇒ Object
Sets location
Attributes
-
location
- String: 2 char representation of location
Example
set_location(“pl”)
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/easy_installer/translate.rb', line 14 def self.set_location(location) @@location = location.to_s path = String.new unless translation_file_path path = File.join("translations", @@location+".yml") else path = File.join(translation_file_path, @@location+".yml") end @@translator = YAML::load(File::open(path)) end |