Class GetText::PO
In: lib/gettext/po.rb
Parent: Object

PO stores PO entries like Hash. Each key of {POEntry} is msgctxt and msgid. PO[msgctxt, msgid] returns the {POEntry} containing msgctxt and msgid. If you specify msgid only, msgctxt is treated as nonexistent.

@since 2.3.4

Methods

[]   []=   each   empty?   has_key?   new   set_comment   to_s  

Included Modules

Enumerable

Classes and Modules

Class GetText::PO::NonExistentEntryError

Attributes

order  [RW]  @!attribute [rw] order
  The order is used to sort PO entries(objects of {POEntry}) in
  {#to_s}.
  @param [:reference, :msgid] order (:reference) The sort key.

    Use `:reference` for sorting by location that message is placed.

    Use `:msgid` for sorting by msgid alphabetical order.

    `:references` is deprecated since 3.0.4. It will be removed
    at 4.0.0. Use `:reference` instead.

  @return [Symbol] the name as order by sort.

Public Class methods

Public Instance methods

Returns {POEntry} containing msgctxt and msgid. If you specify one argument, it is treated as msgid. @overload [](msgid)

  @!macro [new] po.[].argument
    @param [String] msgid msgid contained returning {POEntry}.
    @return [POEntry]
  @!macro po.[].argument

@overload [](msgctxt, msgid)

  @param [String] msgctxt msgctxt contained returning {POEntry}.
  @!macro po.[].argument

Stores {POEntry} or msgstr binding msgctxt and msgid. If you specify msgstr, this method creates {POEntry} containing it. If you specify the two argument, the first argument is treated as msgid.

@overload []=(msgid, po_entry)

  @!macro [new] po.store.entry.arguments
    @param [String] msgid msgid binded {POEntry}.
    @param [POEntry] po_entry stored {POEntry}.
  @!macro po.store.entry.arguments

@overload []=(msgctxt, msgid, po_entry)

  @param [String] msgctxt msgctxt binded {POEntry}.
  @!macro po.store.entry.arguments

@overload []=(msgid, msgstr)

  @!macro [new] po.store.msgstr.arguments
    @param [String] msgid msgid binded {POEntry}.
    @param [String] msgstr msgstr contained {POEntry} stored PO.
      This {POEntry} is generated in this method.
  @!macro po.store.msgstr.arguments

@overload []=(msgctxt, msgid, msgstr)

  @param [String] msgctxt msgctxt binded {POEntry}.
  @!macro po.store.msgstr.arguments

Calls block once for each {POEntry} as a block parameter. @overload each(&block)

  @yield [entry]
  @yieldparam [POEntry] entry {POEntry} in PO.

@overload each

  @return [Enumerator] Returns Enumerator for {POEntry}.

@return [Bool] `true` if there is no entry, `false` otherwise.

Returns if PO stores {POEntry} containing msgctxt and msgid. If you specify one argument, it is treated as msgid and msgctxt is nil.

@overload has_key?(msgid)

  @!macro [new] po.has_key?.arguments
    @param [String] msgid msgid contained {POEntry} checked if it be
      stored PO.
  @!macro po.has_key?.arguments

@overload has_key?(msgctxt, msgid)

  @param [String] msgctxt msgctxt contained {POEntry} checked if
    it be stored PO.
  @!macro po.has_key?.arguments

Formats each {POEntry} to the format of PO files and returns joined them. @see www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files

  The description for Format of PO in GNU gettext manual

@param (see POEntry#to_s) @return [String] Formatted and joined PO entries. It is used for

  creating .po files.

[Validate]