Implements the Unicode transform rules. This is particularly useful from transliterating from one script to another.
def deps do
[
{:unicode_transform, "~> 0.1.0"}
]
end
The docs are found at https://hexdocs.pm/unicode_transform.
CLDR defines a transform specification to aid in transforming text from one script to another. It also defines a number of transforms implementing the specification and this library aims to implement these transforms in elixir.
The strategy used it to generate an elixir module for each of the CLDR transforms. This happens in two parts:
-
The transform defined by CLDR is used to generate an elixir module that contains macro calls modelled on the transform specification. For example, see the generated Unicode.Transform.LatinAscii.ex. Generation is performed with
Unicode.Transform.Generator.generate/2
-
At compilation the macros in the generated module are compiled to elixir code resulting in a module with a single public API
transform/1
The library supports only one transform, Unicode.Transform.LatinAscii
that translates the Latin-1 script to ASCII. This is commonly referred to as "removing accents" although the scope is much broader. The file latin_ascii.ex is largely self-explanatory.