Latinizer v0.2.0 Latinizer View Source
A string-translating module for replacing the regional characters with their closest latin equivalents.
Link to this section Summary
Functions
Replaces specified regional characters with their closest latin equivalent
Link to this section Functions
Link to this function
latinize(string, opts \\ [])
View Source
latinize(binary(), list()) :: binary()
Replaces specified regional characters with their closest latin equivalent.
Returns a string with replaced letters. If the :only
argument is specified,
only the letters provided in this argument will be replaced.
Examples
Translating with no characters specified:
iex> Latinizer.latinize "gżegżółka"
"gzegzolka"
iex> Latinizer.latinize "хорошо"
"horosho"
iex> Latinizer.latinize ""
""
You can pass the :only
option to replace only the specified characters:
iex> Latinizer.latinize "łódeczka", only: ["ł"]
"lódeczka"
iex> Latinizer.latinize "łódeczka", only: ["ł", "ó"]
"lodeczka"
iex> Latinizer.latinize "łódeczka", only: ["ł", "ó", "Ą", "a"]
"lodeczka"