SlopUI.Gettext (SlopUI v0.1.0)

Copy Markdown View Source

The library's own Gettext backend. It holds the slop_ui domain template (priv/gettext/slop_ui.pot) and English defaults.

To translate SlopUI's built-in strings in your app, point the library at your backend and give it a slop_ui domain:

# config/config.exs
config :slop_ui, gettext_backend: MyAppWeb.Gettext

# once, to seed your translations
cp deps/slop_ui/priv/gettext/slop_ui.pot priv/gettext/
mix gettext.merge priv/gettext --locale de

Strings then follow Gettext.get_locale/0 like the rest of your app. If you don't use Gettext, set config :slop_ui, translator: {Mod, :fun} where the function receives (msgid, bindings) and returns a string.

Summary

Functions

handle_missing_bindings(exception, incomplete)

Callback implementation for Gettext.Backend.handle_missing_bindings/2.

handle_missing_plural_translation(locale, domain, msgctxt, msgid, msgid_plural, n, bindings)

Callback implementation for Gettext.Backend.handle_missing_plural_translation/7.

handle_missing_translation(locale, domain, msgctxt, msgid, bindings)

Callback implementation for Gettext.Backend.handle_missing_translation/5.