Kanta.Backend.Adapter.CachedDB (kanta v0.5.1)

Kanta adapter used in *gettext functions from Kanta.Gettext.Macros.

Handles translation lookups in cache and DB for both singular and plural forms.

Summary

Functions

Translates a message with the given locale, domain, context, and message ID.

Translates a plural message with the given locale, domain, context, message IDs, count and bindings.

Functions

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

Translates a message with the given locale, domain, context, and message ID.

Parameters

  • locale - ISO-639 code for the locale
  • domain - Name of the translation domain
  • msgctxt - Optional context for the message
  • msgid - Message ID to translate
  • bindings - Map or keyword list of variables to interpolate

Returns

  • {:ok, translation} - When translation is found
  • {:error, :not_found} - When translation is not found

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

Translates a plural message with the given locale, domain, context, message IDs, count and bindings.

Parameters

  • locale - ISO-639 code for the locale
  • domain - Name of the translation domain
  • msgctxt - Optional context for the message
  • msgid - Singular message ID
  • msgid_plural - Plural message ID
  • n - Count to determine which plural form to use
  • bindings - Map or keyword list of variables to interpolate

Returns

  • {:ok, translation} - When translation is found
  • {:error, :not_found} - When translation is not found