View Source Bonfire.Common.Localise.Gettext.Helpers (bonfire_umbrella v0.9.6-classic-beta.12)

A module providing Internationalization with a gettext-based API.

By using Gettext, your module gains a set of macros for translations, for example:

import Bonfire.Common.Localise.Gettext

# Simple translation

usage:
  <%= l("Hello") %>
  <%= l("Hello %{name}", name: "Bookchin") %>
  <%= l("Hi", [], "test context") %>


output:
  Hello
  Hello Bookchin
  Hi


# Plural translation

usage:
  <%= lp("Hi friend", "Hi friends", 2) %>
  <%= lp("Hiya %{user_or_users}", "Hiyas %{user_or_users}", 1, [user_or_users: "Bookchin"], "test context") %>

output:
  Hi friends
  Hiya Bookchin

See the Gettext Docs for details.

Summary

Functions

Link to this macro

l(original_text_or_id, bindings \\ [], context \\ nil, domain \\ nil)

View Source (macro)
Link to this function

localise_dynamic(msgid, caller_module \\ nil)

View Source
Link to this macro

localise_strings(strings, caller_module \\ nil)

View Source (macro)

Localise a list of strings at compile time

Link to this macro

lp(original_text_or_id, msgid_plural, n, bindings \\ [], context \\ nil, domain \\ nil)

View Source (macro)