API
The API is used to create, edit and delete translations, as well as to retrieve changes to translations.
Obtaining a token
Authorize at localang.xyz and go to the token creation page.

Create a token with the translations:update (push) and translations:read (pull) permissions.
Project ID
The project ID can be found in the project list.

Push translations
The following request can be used to update translations:
curl --location 'https://localang.xyz/api/translations/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-token' \
--data '{
"project_id": 1,
"files": {
"/path/to/file/index.js": {
"operation": "update",
"translations": {
"What is love?": {
"en": "What is love?",
"ar": "ما هو الحب؟"
},
"You have {count} something": {
"en": {
"zero": "You have nothing",
"one": "You have {count} something",
"two": null,
"few": "You have {count} something",
"many": null,
"other": null
},
"ar": {
"zero": "ليس لديك شيء",
"one": null,
"two": null,
"few": null,
"many": null,
"other": null
}
}
}
}
}
}'
Parameters
| Parameter | Value |
|---|---|
project_id | Your project ID |
file.operation | 'update' | 'delete'. 'update' will remove the current translations and overwrite them with the translations from file.translations. 'delete' will delete the translations in the file, file.translations does not need to be passed in this case |
file.translations | Object with translations |
Pull translations
To obtain all translations of the project, the following request can be made:
curl --location 'https://localang.xyz/api/translations/getAll?project_id=2' \
--header 'Authorization: Bearer your-token'