Class GetText::Tools::Task
In: lib/gettext/tools/task.rb
Parent: Object

Methods

Included Modules

GetText Rake::DSL

Classes and Modules

Class GetText::Tools::Task::Error
Class GetText::Tools::Task::Path
Class GetText::Tools::Task::ValidationError

Attributes

domain  [RW]  It is a required parameter.

@return [String] Text domain

enable_description  [W]  @return [Bool] @see enable_description? For details.
enable_po  [W]  @return [Bool] @see enable_po? For details.
files  [RW]  It is a required parameter.

@return [Array<String>] Files that have messages.

locales  [RW]  It is a required parameter.

@return [Array<String>] Supported locales. It is filled from

  {#po_base_directory} by default.
mo_base_directory  [RW]  @return [String] Base directory that has generated MOs. MOs
  are generated into
  `#{mo_base_directory}/#{locale}/LC_MESSAGES/#{domain}.mo`.
msgcat_options  [RW]  @return [Array<String>] Command line options for filtering PO. @see GetText::Tools::MsgCat @see `rmsgcat —help` @since 3.1.3
msginit_options  [RW]  @return [Array<String>] Command line options for creating PO from POT. @see GetText::Tools::MsgInit @see `rmsginit —help`
msgmerge_options  [RW]  @return [Array<String>] Command line options for merging PO with the
  latest POT.

@see GetText::Tools::MsgMerge @see `rmsgmerge —help`

namespace_prefix  [RW]  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

@return [String] Namespace prefix for tasks defined by this class.

package_name  [RW]  @return [String, nil] Package name for messages.
package_version  [RW]  @return [String, nil] Package version for messages.
po_base_directory  [RW] 
pot_creator  [RW]  It is used to custom how to create POT file. The object must have `call` method. The method must accept one argument. The argument
 is a `Pathname` object that represents POT file path.

@example

  GetText::Tools::Task.define do |task|
    task.pot_creator = lambda do |pot_file_path|
      pot_file_path.open("w") do |pot_file|
        pot_file << <<-POT
  msgid "Hello"
  msgstr ""
        POT
      end
    end
  end

@return [Proc]

spec  [R]  @return [Gem::Specification, nil] Package information associated
  with the task.
xgettext_options  [RW]  @return [Array<String>] Command line options for extracting messages
  from sources.

@see GetText::Tools::XGetText @see `rxgettext —help`

Public Class methods

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.

@example Recommended usage

  require "gettext/tools/task"
  # Recommended usage
  GetText::Tools::Task.define do |task|
    task.spec = spec
    # ...
  end
  # Low level API
  task = GetText::Tools::Task.new
  task.spec = spec
  # ...
  task.define

@yield [task] Gives the newely created task to the block. @yieldparam [GetText::Tools::Task] task The task that should be

  configured.

@see define @return [void]

@param [Gem::Specification, nil] spec Package information associated

  with the task. Some information are extracted from the spec.

@see spec= What information are extracted from the spec.

Public Instance methods

Define tasks from configured parameters.

TODO: List defined Rake tasks.

If it is true, each task has description. Otherwise, all tasks doesn‘t have description.

@return [Bool] @since 3.0.1

If it is true, PO related tasks are defined. Otherwise, they are not defined.

This parameter is useful to manage PO written by hand.

@return [Bool] @since 3.0.1

Sets package infromation by Gem::Specification. Here is a list for information extracted from the spec:

  * {#package_name}
  * {#package_version}
  * {#domain}
  * {#files}

@param [Gem::Specification] spec package information for the

  i18n application.

[Validate]