A string with an optional distinct spoken form.
Most values are plain binaries where the printed and spoken forms
agree. When they differ (for example "boss’" printed but "boss’s"
spoken) the value is {print, speak}.
Summary
Functions
Concatenates two speakable strings.
Builds a speakable string, collapsing to a binary when both forms agree.
Returns the printed form.
Returns the spoken form.
Types
Functions
Concatenates two speakable strings.
Arguments
leftis a speakable string.rightis a speakable string.
Returns
The concatenated speakable string, collapsed to a binary when the printed and spoken forms agree.
{:error, exception}if either argument is not a speakable string.
Examples
iex> Localize.Inflection.SpeakableString.concat("the ", "cat")
"the cat"
iex> Localize.Inflection.SpeakableString.concat({"boss’", "boss’s"}, " office")
{"boss’ office", "boss’s office"}
Builds a speakable string, collapsing to a binary when both forms agree.
Arguments
printis the printed form.speakis the spoken form, or nil when it equals the printed form.
Returns
- A speakable string.
Examples
iex> Localize.Inflection.SpeakableString.new("cat", "cat")
"cat"
iex> Localize.Inflection.SpeakableString.new("den", "dén")
{"den", "dén"}
Returns the printed form.
Arguments
speakableis a speakable string.
Returns
The printed form as a binary.
{:error, exception}ifspeakableis not a speakable string.
Examples
iex> Localize.Inflection.SpeakableString.print("den")
"den"
iex> Localize.Inflection.SpeakableString.print({"den", "dén"})
"den"
Returns the spoken form.
Arguments
speakableis a speakable string.
Returns
The spoken form as a binary; the printed form when no distinct spoken form exists.
{:error, exception}ifspeakableis not a speakable string.
Examples
iex> Localize.Inflection.SpeakableString.speak("den")
"den"
iex> Localize.Inflection.SpeakableString.speak({"den", "dén"})
"dén"