Save a string's translation in one locale
curl --request PUT \
--url https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"text": "<string>",
"status": "draft"
}
'const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', status: 'draft'})
};
fetch('https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}"
payload = {
"text": "<string>",
"status": "draft"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"status\": \"draft\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"translation": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stringId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"locale": "<string>",
"text": "<string>",
"status": "draft",
"provenance": "manual",
"origin": "machine",
"reviewedByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reviewedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Translations
Save a string's translation in one locale
Requires strings:write; saving as approved or rejected also requires translations:approve (admins, localization managers and reviewers). Native projects only. Creates or replaces the translation and records a revision attributed to the token owner. Locked segments return 409, text longer than the string’s maxLength returns 422. Without origin, the saved text is labelled as a person’s: human, or machine_post_edited when it changes machine text, and unchanged text keeps its origin. Send origin: machine when the text comes from your own machine translation.
PUT
https://public-api.hyperlocalise.com
/
v1
/
projects
/
{projectId}
/
strings
/
{stringId}
/
translations
/
{locale}
Save a string's translation in one locale
curl --request PUT \
--url https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"text": "<string>",
"status": "draft"
}
'const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', status: 'draft'})
};
fetch('https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}"
payload = {
"text": "<string>",
"status": "draft"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.hyperlocalise.com/v1/projects/{projectId}/strings/{stringId}/translations/{locale}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"status\": \"draft\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"translation": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"stringId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"locale": "<string>",
"text": "<string>",
"status": "draft",
"provenance": "manual",
"origin": "machine",
"reviewedByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reviewedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Path Parameters
Body
application/json
Was this page helpful?

