Skip to content

lokalise/elixir-lokalise-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ElixirLokaliseApi

CI Coverage Status Module Version Hex Docs Total Download License Last Updated

Official Elixir interface for Lokalise APIv2.

If you're looking for an easy solution to exchange translation files between your Elixir project and Lokalise, try ex_lokalise_transfer.

Quickstart

Add a new dependency to mix.exs:

def deps do
  [
    {:elixir_lokalise_api, "~> 4.0"}
  ]
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

Contributors

Languages