Localization Table
Generate Localization Table
Section titled “Generate Localization Table”Generate a localization table asynchronously from source files.
Endpoint: POST /translation/localization-table
Request Body
Section titled “Request Body”{ "sourceLanguage": "en", "targetLanguages": ["de", "fr", "es"], "sourceFile": "https://example.com/localization.json", "format": "json"}Parameters:
sourceLanguage: Source language codetargetLanguages: Array of target language codessourceFile: URL or path to source localization file (optional)format: File format (json, csv, xlsx, etc.) (optional)
Response
Section titled “Response”Success Response (200)
{ "status": "ok", "timestamp": "2025-01-12T22:31:48.856Z", "data": { "id": "localization-123456", "status": "pending" }}Example Request
Section titled “Example Request”curl -X POST "https://platform.algebras.ai/api/v1/translation/localization-table" \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "sourceLanguage": "en", "targetLanguages": ["de", "fr", "es"], "sourceFile": "https://example.com/localization.json", "format": "json" }'import requests
url = "https://platform.algebras.ai/api/v1/translation/localization-table"headers = { "X-Api-Key": "your_api_key_here", "Content-Type": "application/json"}data = { "sourceLanguage": "en", "targetLanguages": ["de", "fr", "es"], "sourceFile": "https://example.com/localization.json", "format": "json"}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200: result = response.json() table_id = result["data"]["id"] table_status = result["data"]["status"] print(f"Localization Table ID: {table_id}, Status: {table_status}")else: print(f"Error: {response.status_code}") print(response.json())const url = "https://platform.algebras.ai/api/v1/translation/localization-table";
const response = await fetch(url, { method: "POST", headers: { "X-Api-Key": "your_api_key_here", "Content-Type": "application/json", }, body: JSON.stringify({ sourceLanguage: "en", targetLanguages: ["de", "fr", "es"], sourceFile: "https://example.com/localization.json", format: "json", }),});
if (response.ok) { const result = await response.json(); console.log("Localization Table ID:", result.data.id); console.log("Status:", result.data.status);} else { const error = await response.json(); console.error("Error:", response.status, error);}package main
import ( "bytes" "encoding/json" "fmt" "io" "net/http")
func main() { url := "https://platform.algebras.ai/api/v1/translation/localization-table"
payload := map[string]interface{}{ "sourceLanguage": "en", "targetLanguages": []string{"de", "fr", "es"}, "sourceFile": "https://example.com/localization.json", "format": "json", }
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) req.Header.Set("X-Api-Key", "your_api_key_here") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 { var result map[string]interface{} json.Unmarshal(body, &result) data := result["data"].(map[string]interface{}) fmt.Printf("Localization Table ID: %v, Status: %v\n", data["id"], data["status"]) } else { fmt.Printf("Error: %d\n", resp.StatusCode) fmt.Println(string(body)) }}Get Localization History
Section titled “Get Localization History”Retrieve a list of all localization table generation tasks.
Endpoint: GET /translation/localization-table
Query Parameters
Section titled “Query Parameters”limit: Maximum number of results to return (optional)offset: Number of results to skip (optional)
Response
Section titled “Response”Success Response (200)
{ "status": "ok", "timestamp": "2025-01-12T22:31:48.856Z", "data": [ { "id": "localization-123456", "status": "completed", "sourceLanguage": "en", "targetLanguages": ["de", "fr"], "createdAt": "2025-01-12T20:00:00.000Z" } ]}Example Request
Section titled “Example Request”curl -X GET "https://platform.algebras.ai/api/v1/translation/localization-table?limit=10&offset=0" \ -H "X-Api-Key: your_api_key_here"import requests
url = "https://platform.algebras.ai/api/v1/translation/localization-table"headers = { "X-Api-Key": "your_api_key_here"}params = { "limit": 10, "offset": 0}
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200: result = response.json() tables = result["data"] for table in tables: print(f"ID: {table['id']}, Status: {table['status']}")else: print(f"Error: {response.status_code}") print(response.json())const url = "https://platform.algebras.ai/api/v1/translation/localization-table";const params = new URLSearchParams({ limit: "10", offset: "0" });
const response = await fetch(`${url}?${params}`, { method: "GET", headers: { "X-Api-Key": "your_api_key_here", },});
if (response.ok) { const result = await response.json(); result.data.forEach((table) => { console.log(`ID: ${table.id}, Status: ${table.status}`); });} else { const error = await response.json(); console.error("Error:", response.status, error);}package main
import ( "encoding/json" "fmt" "io" "net/http" "net/url")
func main() { baseURL := "https://platform.algebras.ai/api/v1/translation/localization-table" params := url.Values{} params.Add("limit", "10") params.Add("offset", "0") fullURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())
req, _ := http.NewRequest("GET", fullURL, nil) req.Header.Set("X-Api-Key", "your_api_key_here")
client := &http.Client{} resp, err :=็ง client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 { var result map[string]interface{} json.Unmarshal(body, &result) tables := result["data"].([]interface{}) for _, table := range tables { t := table.(map[string]interface{}) fmt.Printf("ID: %v, Status: %v\n", t["id"], t["status"]) } } else { fmt.Printf("Error: %d\n", resp.StatusCode) fmt.Println(string(body)) }}Get Localization Table by ID
Section titled “Get Localization Table by ID”Retrieve details of a specific localization table by ID.
Endpoint: GET /translation/localization-table/{id}
Path Parameters
Section titled “Path Parameters”id: Localization table ID
Response
Section titled “Response”Success Response (200)
{ "status": "ok", "timestamp": "2025-01-12T22:31:48.856Z", "data": { "id": "localization-123456", "status": "completed", "sourceLanguage": "en", "targetLanguages": ["de", "fr", "es"], "createdAt": "2025-01-12T20:00:00.000Z", "completedAt": "2025-01-12T20:05:00.000Z" }}Example Request
Section titled “Example Request”curl -X GET "https://platform.algebras.ai/api/v1/translation/localization-table/localization-123456" \ -H "X-Api-Key: your_api_key_here"import requests
table_id = "localization-123456"url = f"https://platform.algebras.ai/api/v1/translation/localization-table/{table_id}"headers = { "X-Api-Key": "your_api_key_here"}
response = requests.get(url, headers=headers)
if response.status_code == 200: result = response.json() table_data = result["data"] print(f"ID: {table_data['id']}") print(f"Status: {table_data['status']}") print(f"Source Language: {table_data['sourceLanguage']}") print(f"Target Languages: {table_data['targetLanguages']}")else: print(f"Error: {response.status_code}") print(response.json())const tableId = "localization-123456";const url = `https://platform.algebras.ai/api/v1/translation/localization-table/${tableId}`;
const response = await fetch(url, { method: "GET", headers: { "X-Api-Key": "your_api_key_here", },});
if (response.ok) { const result = await response.json(); console.log("ID:", result.data.id); console.log("Status:", result.data.status); console.log("Source Language:", result.data.sourceLanguage); console.log("Target Languages:", result.data.targetLanguages);} else { const error = await response.json(); console.error("Error:", response.status, error);}package main
import ( "encoding/json" "fmt" "io" "net/http")
func main() { tableID := "localization-123456" url := fmt.Sprintf("https://platform.algebras.ai/api/v1/translation/localization-table/%s", tableID)
req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-Api-Key", "your_api_key_here")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 { var result map[string]interface{} json.Unmarshal(body, &result) data := result["data"].(map[string]interface{}) fmt.Printf("ID: %v\n", data["id"]) fmt.Printf("Status: %v\n", data["status"]) fmt.Printf("Source Language: %v\n", data["sourceLanguage"]) fmt.Printf("Target Languages: %v\n", data["targetLanguages"]) } else { fmt.Printf("Error: %d\n", resp.StatusCode) fmt.Println(string(body)) }}Download Localization File
Section titled “Download Localization File”Get a download URL for a completed localization table file.
Endpoint: GET /translation/localization-table/{id}/download
Path Parameters
Section titled “Path Parameters”id: Localization table ID
Response
Section titled “Response”Success Response (200)
{ "status": "ok", "timestamp": "2025-01-12T22:31:48.856Z", "data": { "downloadUrl": "https://cdn.algebras.ai/files/localization-123456.zip", "expiresAt": "2025-01-13T22:31:48.856Z" }}Example Request
Section titled “Example Request”curl -X GET "https://platform.algebras.ai/api/v1/translation/localization-table/localization-123456/download" \ -H "X-Api-Key: your_api_key_here"import requests
table_id = "localization-123456"url = f"https://platform.algebras.ai/api/v1/translation/localization-table/{table_id}/download"headers = { "X-Api-Key": "your_api_key_here"}
response = requests.get(url, headers=headers)
if response.status_code == 200: result = response.json() download_url = result["data"]["downloadUrl"] expires_at = result["data"]["expiresAt"] print(f"Download URL: {download_url}") print(f"Expires at: {expires_at}")else: print(f"Error: {response.status_code}") print(response.json())const tableId = "localization-123456";const url = `https://platform.algebras.ai/api/v1/translation/localization-table/${tableId}/download`;
const response = await fetch(url, { method: "GET", headers: { "X-Api-Key": "your_api_key_here", },});
if (response.ok) { const result = await response.json(); console.log("Download URL:", result.data.downloadUrl); console.log("Expires at:", result.data.expiresAt);} else { const error = await response.json(); console.error("Error:", response.status, error);}package main
import ( "encoding/json" "fmt" "io" "net/http")
func main() { tableID := "localization-123456" url := fmt.Sprintf("https://platform.algebras.ai/api/v1/translation/localization-table/%s/download", tableID)
req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-Api-Key", "your_api_key_here")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 { var result map[string]interface{} json.Unmarshal(body, &result) data := result["data"].(map[string]interface{}) fmt.Printf("Download URL: %v\n", data["downloadUrl"]) fmt.Printf("Expires at: %v\n", data["expiresAt"]) } else { fmt.Printf("Error: %d\n", resp.StatusCode) fmt.Println(string(body)) }}