View Source Gettext.Interpolation behaviour (gettext v0.22.0)
Behaviour to provide Gettext string interpolation.
By default, Gettext uses Gettext.Interpolation.Default
as the interpolation module.
Link to this section 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.
Link to this section Types
@type translation_type() :: :translation | :plural_translation
Link to this section Callbacks
compile_interpolate(translation_type, message, bindings)
View Source (since 0.19.0)@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.