1defmodule Gettext.PO.Translation do
2  @moduledoc """
3  A struct that holds information on a translation.
4
5  This struct describes a translation that has no plural form, such as the one
6  in the following snippet of `.po` file:
7
8      msgid "Hello world!"
9      msgstr "Ciao mondo!"
10
11  Translations with a plural form are not represented as
12  `Gettext.PO.Translation` structs, but as `Gettext.PO.PluralTranslation`
13  structs.
14
15  This struct contains the following fields:
16
17    * `msgid` - the id of the translation.
18    * `msgstr` - the translated string.
19    * `comments` - a list of comments as they are found in the PO file (for example,
20      `["# foo"]`).
21    * `extracted_comments` - a list of extracted comments (for example,
22      `["#. foo", "#. bar"]`).
23    * `references` - a list of references (files this translation comes from) in
24      the form `{file, line}`.
25    * `flags` - a set of flags for this translation.
26    * `po_source_line` - the line this translation is on in the PO file where it
27      comes from.
28
29  """
30
31  @type t :: %__MODULE__{
32          msgid: [binary],
33          msgstr: [binary],
34          comments: [binary],
35          extracted_comments: [binary],
36          references: [{binary, pos_integer}],
37          flags: MapSet.t(),
38          po_source_line: pos_integer
39        }
40
41  @enforce_keys [:msgid]
42
43  defstruct msgid: nil,
44            msgstr: nil,
45            comments: [],
46            extracted_comments: [],
47            references: [],
48            flags: MapSet.new(),
49            po_source_line: nil
50end
51