Lokalise APIv2 Elixir SDK

Elixir interface for the Lokalise APIv2.

View the Project on GitHub lokalise/elixir-lokalise-api




Glossary terms

List glossary terms

API doc

{:ok, glossary_terms} = GlossaryTerms.all(@project_id, limit: 2, cursor: "5319746")

glossary_term = glossary_terms.items |> List.first()

glossary_term.term # => "sample term"

Fetch a glossary term

API doc

term_id = 5_319_746
{:ok, glossary_term} = GlossaryTerms.find(@project_id, term_id)

glossary_term.term # => "router"
glossary_term.description # => "A commonly used network device"

Create glossary terms

API doc

data = %{
  terms: [
    %{
      term: "elixir",
      description: "language",
      caseSensitive: false,
      translatable: false,
      forbidden: false
    }
  ]
}

{:ok, glossary_terms} = GlossaryTerms.create(@project_id, data)

glossary_term = hd(glossary_terms.items)

glossary_term.term # => "elixir"
glossary_term.description # => "language"

Update glossary terms

API doc

data = %{
  terms: [
    %{
      id: 1234,
      description: "elixir updated",
      tags: ["sample"]
    },
    %{
      id: 5789,
      caseSensitive: true
    }
  ]
}

{:ok, glossary_terms} = GlossaryTerms.update_bulk(@project_id, data)

glossary_term = hd(glossary_terms)

glossary_term.description # => "elixir updated"

Delete glossary terms

API doc

data = %{
  terms: [
    12345,
    6789
  ]
}

{:ok, %{} = response} = GlossaryTerms.delete_bulk(@project_id, data)

response[:data][:deleted][:count] # => 2