Packages
gettext
0.19.0
1.0.2
1.0.1
retired
1.0.0
0.26.2
0.26.1
0.26.0
retired
0.25.0
0.24.0
0.23.1
0.23.0
0.22.3
0.22.2
0.22.1
0.22.0
0.21.0
0.20.0
0.19.1
0.19.0
0.18.2
0.18.1
0.18.0
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.1
0.16.0
0.15.0
0.14.1
0.14.0
0.13.1
0.13.0
0.12.2
0.12.1
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.0
0.6.1
0.6.0
0.5.0
Internationalization and localization through gettext
Current section
Files
Jump to
Current section
Files
lib/gettext/po/plural_translation.ex
defmodule Gettext.PO.PluralTranslation do
@moduledoc """
A struct that holds information on a plural translation.
This struct describes a translation which has a plural form, such as the one
in the following snippet of `.po` file:
msgid "There was an error"
msgid_plural "There were %{count} errors"
msgstr[0] "C'è stato un errore"
msgstr[1] "Ci sono stati %{count} errori"
This struct contains three fields:
* `msgid` - the id of the singular translation.
* `msgid_plural` - the id of the pluralized translation.
* `msgstr` - a map which maps plural forms as keys to translated strings as
values. The plural forms mentioned here are the ones described in
`Gettext.Plural`.
* `comments` - a list of comments as they are found in the PO file (for example,
`["# foo"]`).
* `extracted_comments` - a list of extracted comments (for example,
`["#. foo", "#. bar"]`).
* `references` - a list of references (files this translation comes from) in
the form `{file, line}`.
* `flags` - a set of flags for this translation.
* `po_source_line` - the line this translation is on in the PO file where it
comes from.
"""
@type t :: %__MODULE__{
msgid: [binary],
msgid_plural: [binary] | nil,
msgstr: %{non_neg_integer => [binary]},
msgctxt: [binary] | nil,
comments: [binary],
extracted_comments: [binary],
references: [{binary, pos_integer}],
flags: MapSet.t(),
po_source_line: pos_integer
}
@enforce_keys [:msgid, :msgid_plural]
defstruct msgid: nil,
msgid_plural: nil,
msgstr: [],
msgctxt: nil,
comments: [],
extracted_comments: [],
references: [],
flags: MapSet.new(),
po_source_line: 1
end