View Source Gettext.Interpolation behaviour (gettext v1.0.0)
Behaviour to provide Gettext string interpolation.
By default, Gettext uses Gettext.Interpolation.Default
as the interpolation module.
Summary
Callbacks
Called to perform interpolation at compile time.
Defines the Gettext message format to be used when extracting.
Called to perform interpolation at runtime.
Types
Callbacks
@macrocallback compile_interpolate(translation_type(), message :: String.t(), bindings()) :: Macro.t()
Called to perform interpolation at compile time.
@callback message_format() :: String.t()
Defines the Gettext message format to be used when extracting.
The default interpolation module that ships with Gettext uses "elixir-format"
.
See the GNU Gettext documentation.
@callback runtime_interpolate(message :: String.t(), bindings()) :: {:ok, String.t()} | {:missing_bindings, partially_interpolated_message :: String.t(), missing_bindings :: [atom()]}
Called to perform interpolation at runtime.
If successful, should return {:ok, interpolated_string}
. If there
are missing bindings, should return {:missing_bindings, partially_interpolated, missing}
where partially_interpolated
is a string with the available bindings interpolated.