I18nParser v0.1.9 I18nParser View Source

Module for parsing i18n files

Link to this section Summary

Link to this section Functions

Link to this function

convert(file, extension, options \\ %{}) View Source

Convert data from file

Parameters

  • file: path to file for locale detection
  • extension: extension of the file, like "yml"
  • options: options for converting

Examples

iex> I18nParser.convert("/some_path_to_file", "yml", options)
{
  :ok,
  %{
    "buttons" => %{"click" => "##0##"},
    "welcome" => %{"index" => %{"first" => "##1##", "last" => "##2##"}}
  },
  [{0, "Click me!"}, {1, "Hello"}, {2, "Buy"}]
}
Link to this function

detect(file, extension, options \\ %{}) View Source

Detects locale for the file

Parameters

  • file: path to file for locale detection
  • extension: extension of the file, like "yml"
  • options: options for detection

Examples

iex> I18nParser.detect("/some_path_to_file", "yml", options)
{:ok, %{code: "en"}}