View Source ElixirLokaliseApi
Official Elixir interface for Lokalise APIv2.
Quickstart
Add a new dependency to mix.exs
:
def deps do
[
{:elixir_lokalise_api, "~> 3.3"}
]
end
Put your Lokalise API token into config.exs
:
config :elixir_lokalise_api, api_token: "LOKALISE_API_TOKEN"
If you are using ENV variables, use the following approach:
config :elixir_lokalise_api, api_token: {:system, "LOKALISE_API_TOKEN"}
Now you can perform API calls:
project_data = %{name: "Elixir", description: "Created via API"}
{:ok, project} = ElixirLokaliseApi.Projects.create(project_data)
project.name |> IO.puts # => "Elixir"
translation_data = %{
data: "ZnI6...",
filename: "sample.yml",
lang_iso: "en"
}
{:ok, process} = ElixirLokaliseApi.Files.upload(project.project_id, data)
{:ok, process} = QueuedProcesses.find(project.project_id, process.process_id)
process.status |> IO.puts # => "finished"
Documentation
All documentation and usage examples can be found at lokalise.github.io/elixir-lokalise-api.
Brief API reference is also available at hexdocs.pm.
Copyright and License
Licensed under the BSD 3 Clause license.
Copyright (c) 2022 Lokalise group and Ilya Krukowski