exi18n v0.9.0 ExI18n.Loader.YAML View Source

Loads translations from YAML files.

Link to this section Summary

Functions

Loads yaml file with translations.

Link to this section Functions

Link to this function

load(locale, options \\ %{})

View Source

Loads yaml file with translations.

Parameters

  • locale: String with name of locale/file.
  • options: Map with options for loader.

Examples

iex> ExI18n.Loader.YAML.load("en", %{path: "test/fixtures"})
{:ok, %{"empty" => "empty", "hello" => "Hello world", "hello_2" => %{"world" => "test"},"hello_many" => ["Joe", "Mike"], "hello_name" => "Hello %{name}","incomplete" => %{"path" => %{"text" => "test"}}, "number" => 1}}

iex> ExI18n.Loader.YAML.load("invalid", %{path: "test/fixtures"})
{:error, "Failed to open file test/fixtures/invalid.yml"}