MyApp.Cldr.Trans (Cldr v2.26.0) View Source
Backend module to generate translation schemas for user of the trans library.
WHen defining structured translations for Ecto schemas
the Trans documentation shows the following example
defmodule MyApp.Article do
  use Ecto.Schema
  use Trans, translates: [:title, :body]
  schema "articles" do
    field :title, :string
    field :body, :string
    embeds_one :translations, Translations, on_replace: :update, primary_key: false do
      embeds_one :es, MyApp.Article.Translation, on_replace: :update
      embeds_one :fr, MyApp.Article.Translation, on_replace: :update
    end
  end
endUsing the translate/3 macro in this module, the following
will configure structued translations for all locales configured
in this backend.  An example is:
defmodule MyApp.Article do
  use Ecto.Schema
  use Trans, translates: [:title, :body]
  use MyApp.Cldr.Trans
  schema "articles" do
    field :title, :string
    field :body, :string
    # The translation module name and the options
    # may be ommitted - the defaults are those shown
    translations :translations, Translations, on_replace: :update, primary_key: false
  end
end