Call the endpoint directly from any Xcojo property:
fetch('https://dev.xcojo.com/Language/?text=' + encodeURIComponent('Welcome to Xcojo') + '&source=en&target=es')
.then(r => r.json())
.then(data => {
if (data.status === 'success') {
console.log(data.translated_text);
} else {
console.error(data.error);
}
});
Use LibreTranslate instead of the default MyMemory provider:
https://dev.xcojo.com/Language/?text=Hello&source=en&target=fr&provider=libre
{
"status": "success",
"provider": "mymemory",
"source_lang": "en",
"target_lang": "es",
"source_text": "Welcome to Xcojo",
"translated_text": "Bienvenido a Xcojo"
}
These are not wired up by default because they require an account and API key — but if Xcojo later needs higher volume or better quality than the free providers, here's how each plugs in.
// Requires a Google Cloud project + API key (billed per character past free credits) $url = 'https://translation.googleapis.com/language/translate/v2?key=' . $apiKey; $response = file_get_contents($url . '&q=' . urlencode($text) . '&source=' . $source . '&target=' . $target);
// Requires an Azure account + Translator resource key (2M chars/month free tier, then billed)
$ch = curl_init('https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&from=' . $source . '&to=' . $target);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Ocp-Apim-Subscription-Key: ' . $apiKey,
'Ocp-Apim-Subscription-Region: ' . $region,
'Content-Type: application/json',
]);
Apple does not offer a server-side translation API. Its Translate framework only runs on-device inside iOS/macOS apps — there's nothing for this PHP engine to call.
Welcome to the Xcojo Language Engine & API. This service provides a single, centralized translation endpoint for xcojo.com properties, backed by free providers that require no API key.
text: The text to translate (required)source: Source language code, e.g. en (default: en)target: Target language code, e.g. es (default: es)provider: mymemory (default) or libre| Provider | Cost | Signup | Notes |
|---|---|---|---|
| MyMemory | Free | None | ~5,000 words/day per IP; more with an attribution email |
| LibreTranslate | Free | None | Public instances are community-run — can be slow or briefly down |
| Google Cloud Translation | Paid past free credit | Required | Needs a Google Cloud project + billing account |
| Microsoft Azure Translator | Free tier, then paid | Required | 2M characters/month free, needs an Azure account |
| Apple | No server-side API — on-device only, not usable here | ||
All endpoints include automatic CORS headers (Access-Control-Allow-Origin: *) enabling cross-domain usage across xcojo.com subdomains.
English (en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Dutch (nl), Russian (ru), Chinese (zh), Japanese (ja), Korean (ko), Arabic (ar), Hindi (hi), Swahili (sw), Turkish (tr), Polish (pl), Vietnamese (vi), Thai (th), Indonesian (id), Ukrainian (uk)