Class: GetText::Tools::Task
- Inherits:
-
Object
- Object
- GetText::Tools::Task
- Includes:
- GetText, Rake::DSL
- Defined in:
- lib/gettext/tools/task.rb
Defined Under Namespace
Classes: Error, ValidationError
Constant Summary
Constants included from GetText
Instance Attribute Summary collapse
-
#domain ⇒ String
It is a required parameter.
- #enable_description ⇒ Bool writeonly
- #enable_po ⇒ Bool writeonly
-
#files ⇒ Array<String>
It is a required parameter.
-
#locales ⇒ Array<String>
It is a required parameter.
-
#mo_base_directory ⇒ String
Base directory that has generated MOs.
-
#msginit_options ⇒ Array<String>
Command line options for creating PO from POT.
-
#msgmerge_options ⇒ Array<String>
Command line options for merging PO with the latest POT.
-
#namespace_prefix ⇒ String
It is useful when you have multiple domains.
-
#package_name ⇒ String?
Package name for messages.
-
#package_version ⇒ String?
Package version for messages.
-
#po_base_directory ⇒ Object
Returns the value of attribute po_base_directory.
-
#spec ⇒ Gem::Specification?
Package information associated with the task.
-
#xgettext_options ⇒ Array<String>
Command line options for extracting messages from sources.
Class Method Summary collapse
-
.define {|task| ... } ⇒ void
Define gettext related Rake tasks.
Instance Method Summary collapse
-
#define ⇒ Object
Define tasks from configured parameters.
-
#enable_description? ⇒ Bool
If it is true, each task has description.
-
#enable_po? ⇒ Bool
If it is true, PO related tasks are defined.
-
#initialize(spec = nil) ⇒ Task
constructor
A new instance of Task.
Methods included from GetText
#N_, #Nn_, #bindtextdomain, #bindtextdomain_to, #cgi, #cgi=, #gettext, included, #locale, #ngettext, #npgettext, #nsgettext, #output_charset, #pgettext, #set_cgi, #set_current_locale, #set_locale, #set_output_charset, #sgettext, #textdomain, #textdomain_to
Constructor Details
#initialize(spec = nil) ⇒ Task
Returns a new instance of Task.
146 147 148 149 150 151 152 153 154 |
# File 'lib/gettext/tools/task.rb', line 146 def initialize(spec=nil) initialize_variables self.spec = spec if spec yield(self) if block_given? warn("Use #{self.class.name}.define instead of #{self.class.name}.new(spec).") define end end |
Instance Attribute Details
#domain ⇒ String
It is a required parameter.
105 106 107 |
# File 'lib/gettext/tools/task.rb', line 105 def domain @domain end |
#enable_description=(value) ⇒ Bool (writeonly)
137 138 139 |
# File 'lib/gettext/tools/task.rb', line 137 def enable_description=(value) @enable_description = value end |
#enable_po=(value) ⇒ Bool (writeonly)
141 142 143 |
# File 'lib/gettext/tools/task.rb', line 141 def enable_po=(value) @enable_po = value end |
#files ⇒ Array<String>
It is a required parameter.
101 102 103 |
# File 'lib/gettext/tools/task.rb', line 101 def files @files end |
#locales ⇒ Array<String>
It is a required parameter.
92 93 94 |
# File 'lib/gettext/tools/task.rb', line 92 def locales @locales end |
#mo_base_directory ⇒ String
97 98 99 |
# File 'lib/gettext/tools/task.rb', line 97 def mo_base_directory @mo_base_directory end |
#msginit_options ⇒ Array<String>
Returns Command line options for creating PO from POT.
127 128 129 |
# File 'lib/gettext/tools/task.rb', line 127 def end |
#msgmerge_options ⇒ Array<String>
Returns Command line options for merging PO with the latest POT.
133 134 135 |
# File 'lib/gettext/tools/task.rb', line 133 def end |
#namespace_prefix ⇒ String
It is useful when you have multiple domains. You can define tasks for each domains by using different namespace prefix.
It is nil by default. It means that tasks are defined at top
level.
TODO: example
116 117 118 |
# File 'lib/gettext/tools/task.rb', line 116 def namespace_prefix @namespace_prefix end |
#package_name ⇒ String?
83 84 85 |
# File 'lib/gettext/tools/task.rb', line 83 def package_name @package_name end |
#package_version ⇒ String?
86 87 88 |
# File 'lib/gettext/tools/task.rb', line 86 def package_version @package_version end |
#po_base_directory ⇒ Object
Returns the value of attribute po_base_directory.
93 94 95 |
# File 'lib/gettext/tools/task.rb', line 93 def po_base_directory @po_base_directory end |
#spec ⇒ Gem::Specification?
80 81 82 |
# File 'lib/gettext/tools/task.rb', line 80 def spec @spec end |
#xgettext_options ⇒ Array<String>
Returns Command line options for extracting messages from sources.
122 123 124 |
# File 'lib/gettext/tools/task.rb', line 122 def end |
Class Method Details
.define {|task| ... } ⇒ void
This method returns an undefined value.
Define gettext related Rake tasks. Normally, use this method to define tasks because this method is a convenient API.
See accessor APIs how to configure this task.
See #define for what task is defined.
71 72 73 74 75 |
# File 'lib/gettext/tools/task.rb', line 71 def define task = new yield(task) task.define end |
Instance Method Details
#define ⇒ Object
Define tasks from configured parameters.
TODO: List defined Rake tasks.
179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/gettext/tools/task.rb', line 179 def define ensure_variables validate define_file_tasks if namespace_prefix namespace_recursive namespace_prefix do define_named_tasks end else define_named_tasks end end |
#enable_description? ⇒ Bool
If it is true, each task has description. Otherwise, all tasks doesn't have description.
198 199 200 |
# File 'lib/gettext/tools/task.rb', line 198 def enable_description? @enable_description end |
#enable_po? ⇒ Bool
If it is true, PO related tasks are defined. Otherwise, they are not defined.
This parameter is useful to manage PO written by hand.
209 210 211 |
# File 'lib/gettext/tools/task.rb', line 209 def enable_po? @enable_po end |