Skip to content

lokalise/elixir-lokalise-api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ElixirLokaliseApi

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

Official Elixir interface for Lokalise APIv2.

Quickstart

Add a new dependency to mix.exs:

def deps do
  [
    {:elixir_lokalise_api, "~> 2.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