exi18n v0.6.0 ExI18n.Loader.YAML

Loads translations from YAML files.

Summary

Functions

Loads yaml file with translations

Functions

load(locale, options \\ %{})
load(String.t, Map.t) :: Map.t

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"})
%{"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"})
** (ArgumentError) Failed to open file test/fixtures/invalid.yml