ExCrowdin (ex_crowdin v0.2.3)

Link to this section Summary

Functions

Create a file on Crowdin with unique name

Get all tronslations of a file on Crowdin for a language

Get crowin file ID by name. If it doesn't exist, create a new one.

Upload a record to Crowdin

Link to this section Functions

Link to this function

create_crowdin_file(struct)

Specs

create_crowdin_file(struct()) :: [ok: binary(), error: any()]

Create a file on Crowdin with unique name

Example

{:ok, %{"data" => %{"id" => id}}} = ExCrowdin.create_crowdin_file(%Job{})
Link to this function

get_crowdin_translations(locale, field, file_id, page \\ 0)

Specs

get_crowdin_translations(binary(), atom(), binary(), integer()) ::
  {:ok, list()} | {:error, any()}

Get all tronslations of a file on Crowdin for a language

Example

{:ok, %{"data" => %{"stringId" => string_id, "text" => text}}} = ExCrowdin.get_crowdin_translations("fr", title, 4576)
Link to this function

get_file_id(struct, field)

Specs

get_file_id(struct(), atom()) :: {:ok, binary()} | {:error, any()}

Get crowin file ID by name. If it doesn't exist, create a new one.

Example

{:ok, file_id} = ExCrowdin.get_file_id(%Job{}, :title)
Link to this function

upload_one(struct, field, file_id)

Specs

upload_one(struct(), atom(), binary()) :: {:ok, binary()} | {:error, any()}

Upload a record to Crowdin

Example

job = Repo.one(Job, limit: 1)
{ok, file_id} = ExCrowdin.get_file_id(%Job{}, :title)
{:ok, string_id} <- ExCrowdin.upload_one(job, :title, file_id)