{"id":26496692,"url":"https://github.com/gvl/exi18n","last_synced_at":"2025-07-14T22:33:30.970Z","repository":{"id":62429131,"uuid":"83309871","full_name":"gvl/exi18n","owner":"gvl","description":"ExI18n is key-based internationalization library for Elixir.","archived":false,"fork":false,"pushed_at":"2021-10-26T16:07:52.000Z","size":73,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T04:41:13.508Z","etag":null,"topics":["elixir","i18n","internationalisation","translation","yaml"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gvl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-27T12:51:04.000Z","updated_at":"2023-03-04T12:04:20.000Z","dependencies_parsed_at":"2022-11-01T20:05:32.127Z","dependency_job_id":null,"html_url":"https://github.com/gvl/exi18n","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/gvl/exi18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvl%2Fexi18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvl%2Fexi18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvl%2Fexi18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvl%2Fexi18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gvl","download_url":"https://codeload.github.com/gvl/exi18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gvl%2Fexi18n/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265360557,"owners_count":23752736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","i18n","internationalisation","translation","yaml"],"created_at":"2025-03-20T12:23:10.078Z","updated_at":"2025-07-14T22:33:30.909Z","avatar_url":"https://github.com/gvl.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExI18n\n\n[![hex.pm version](https://img.shields.io/hexpm/v/exi18n.svg)](https://hex.pm/packages/exi18n) [![Build Status](https://travis-ci.org/gvl/exi18n.svg?branch=master)](https://travis-ci.org/gvl/exi18n) [![Coverage Status](https://coveralls.io/repos/gvl/exi18n/badge.svg?branch=master)](https://coveralls.io/r/gvl/exi18n?branch=master) [![Inline docs](http://inch-ci.org/github/gvl/exi18n.svg?branch=master\u0026style=shields)](http://inch-ci.org/github/gvl/exi18n)\n\n**ExI18n** is key-based internationalization library for Elixir.\n\n## Table of Contents\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n  * [Configuration parameters](#configuration-parameters)\n* [Loaders](#loaders)\n  * [YAML](#yaml)\n  * [Custom](#custom)\n* [Documentation](#documentation)\n\n## Installation\n\nAdd `exi18n` to your list of dependencies and to `applications` in `mix.exs`:\n\n```elixir\n# mix.exs\n\ndef deps do\n  [\n    {:exi18n, \"~\u003e 0.9.0\"},\n  ]\nend\n\ndef application do\n  [applications: [\n    :exi18n,\n  ]]\nend\n```\n\n## Configuration\n\nAdd configuration to your `config/config.exs`:\n\n```elixir\n# config.exs\n\nconfig :exi18n,\n  default_locale: \"en\",\n  locales: ~w(en),\n  fallback: false,\n  loader: :yml,\n  loader_options: %{path: \"priv/locales\"},\n  var_prefix: \"%{\",\n  var_suffix: \"}\"\n```\n\n### Configuration parameters\n\n| Option | Description | Default |\n| :-- | :-- | :--: |\n| default_locale | Default locale in your application. | `\"en\"` |\n| locales | Supported locales. | `[\"en\"]` |\n| fallback | Fallback to default locale if translation empty. | `false` |\n| loader | Translation loader. Supported types: `:yml`, `:http`, `MyApp.Loader`. | `:yml` |\n| loader_options | Translation loader options. | `%{}` |\n| var_prefix | Prefix for values in translations. | `\"%{\"` |\n| var_suffix | Suffix for values in translations. | `\"}\"` |\n\n## Loaders\n\n### YAML\n\nThis loader will use yaml files from `path` to load translations.\n\n#### Module\n\n`ExI18n.Loader.YAML`\n\n#### Dependencies\n\n```elixir\n# mix.exs\n\ndef deps do\n  [\n    {:exi18n, \"~\u003e 0.9.0\"},\n    {:yaml_elixir, \"~\u003e 2.0\"},\n  ]\nend\n\ndef application do\n  [applications: [\n    :exi18n,\n    :yaml_elixir,\n  ]]\nend\n```\n\n#### Configuration\n\n| Option | Required | Description |\n| :-- | :--: | :-- |\n| path | **Yes** | Path to locale files. |\n\n```elixir\n# config.exs\n\nconfig :exi18n,\n  loader: :yml,\n  loader_options: %{\n    path: \"priv/locales\" # or {MyHelper, :path, [\"priv/locales\"]}\n  }\n```\n\n### Custom\n\n#### Module\n\n`MyApp.Loader`\n\nMake sure that your custom loader has `load/2` function that accepts `locale` and `options` as parameters and returns `Map` with translations.\n\nExample:\n\n```elixir\ndefmodule MyApp.Loader do\n  def load(locale, _options) do\n    %{\n      \"en\" =\u003e %{...},\n      \"de\" =\u003e %{...}\n    }[locale]\n  end\nend\n```\n\n#### Dependencies\n\n```elixir\n# mix.exs\n\ndef deps do\n  [\n    {:exi18n, \"~\u003e 0.9.0\"},\n  ]\nend\n\ndef application do\n  [applications: [\n    :exi18n,\n  ]]\nend\n```\n\n#### Configuration\n\n```elixir\n# config.exs\n\nconfig :exi18n,\n  loader: MyApp.Loader,\n  loader_options: %{my_config: \"value\"}\n```\n\n## Documentation\n\n[https://hexdocs.pm/exi18n](https://hexdocs.pm/exi18n)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvl%2Fexi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgvl%2Fexi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgvl%2Fexi18n/lists"}