Class YARD::I18n::Text
In: lib/yard/i18n/text.rb
Parent: Object

Provides some convenient features for translating a text.

Methods

Public Class methods

Creates a text object that has translation related features for the input text.

@param [each_line] input a text to be translated. @option options [Boolean] :have_header (false) whether the

  input text has header or not.

Public Instance methods

Extracts translation target messages from +@input+.

@yield [:attribute, name, value, line_no] the block that

  recieves extracted an attribute in header. It may called many
  times.

@yieldparam [String] name the name of extracted attribute. @yieldparam [String] value the value of extracted attribute. @yieldparam [Integer] line_no the defined line number of extracted

  attribute.

@yield [:paragraph, text, start_line_no] the block that

  recieves extracted a paragraph in body. Paragraph is a text
  block separated by one or more empty lines. Empty line is a
  line that contains only zero or more whitespaces. It may
  called many times.

@yieldparam [String] text the text of extracted paragraph. @yieldparam [Integer] start_line_no the start line number of

  extracted paragraph.

@return [void]

Translates into locale.

@param [Locale] locale the translation target locale. @return [String] translated text.

[Validate]