View Source Expo.Translation (expo v0.1.0-beta.5)
Translation Structs
Link to this section Summary
Functions
Append flag to translation
Tells whether the given translation has the flag specified
Returns a "key" that can be used to identify a translation.
Tells whether two translations are the same translation according to their
msgid.
Link to this section Types
@opaque key()
key that can be used to identify a translation
@type msgctxt() :: String.t()
@type msgid() :: [String.t()]
@type msgstr() :: [String.t()]
@type t() :: Expo.Translation.Singular.t() | Expo.Translation.Plural.t()
Link to this section Functions
Append flag to translation
Keeps the line formatting intact
examples
Examples
iex> translation = %Expo.Translation.Singular{msgid: [], msgstr: [], flags: []}
iex> Expo.Translation.append_flag(translation, "foo")
%Expo.Translation.Singular{msgid: [], msgstr: [], flags: [["foo"]]}
Tells whether the given translation has the flag specified
examples
Examples
iex> Expo.Translation.has_flag?(%Expo.Translation.Singular{msgid: [], msgstr: [], flags: [["foo"]]}, "foo")
true
iex> Expo.Translation.has_flag?(%Expo.Translation.Singular{msgid: [], msgstr: [], flags: [["foo"]]}, "bar")
false
Returns a "key" that can be used to identify a translation.
This function returns a "key" that can be used to uniquely identify a
translation assuming that no "same" translations exist; for what "same"
means, look at the documentation for same?/2.
The purpose of this function is to be used in situations where we'd like to group or sort translations but where we don't need the whole structs.
examples
Examples
iex> t1 = %Expo.Translation.Singular{msgid: ["foo"], msgstr: []}
iex> t2 = %Expo.Translation.Singular{msgid: ["", "foo"], msgstr: []}
iex> Expo.Translation.key(t1) == Expo.Translation.key(t2)
true
iex> t1 = %Expo.Translation.Singular{msgid: ["foo"], msgstr: []}
iex> t2 = %Expo.Translation.Singular{msgid: ["bar"], msgstr: []}
iex> Expo.Translation.key(t1) == Expo.Translation.key(t2)
false
Tells whether two translations are the same translation according to their
msgid.
This function returns true if translation1 and translation2 are the same
translation, where "the same" means they have the same msgid or the same
msgid and msgid_plural.
examples
Examples
iex> t1 = %Expo.Translation.Singular{msgid: ["foo"], msgstr: []}
iex> t2 = %Expo.Translation.Singular{msgid: ["", "foo"], msgstr: []}
iex> Expo.Translation.same?(t1, t2)
true
iex> t1 = %Expo.Translation.Singular{msgid: ["foo"], msgstr: []}
iex> t2 = %Expo.Translation.Singular{msgid: ["bar"], msgstr: []}
iex> Expo.Translation.same?(t1, t2)
false