Kanta.Backend (kanta v0.5.1)

Kanta.Backend is a module that provides an enhanced Gettext backend with database support.

It extends the standard Gettext functionality by:

  1. First checking for translations in the database
  2. Falling back to PO file translations if not found in the database

Usage

defmodule MyApp.Gettext do
  use Kanta.Backend, otp_app: :my_app
end

Options

  • :otp_app - The OTP application that contains the backend
  • :priv - The directory where the translations are stored (defaults to "priv/YOUR_MODULE")
  • :kanta_adapter - The adapter module to use for database lookups (defaults to Kanta.Backend.Adapter.CachedDB)

it also accepts all the Gettext.Backend options. See the official Gettext documentation for more details.